修改定时执行工作流
CI / Docker-Build (push) Successful in 2m30s Details
公网服务发布 / Docker-Build-Push (push) Failing after 14s Details

添加清理docker tag为none镜像步骤
This commit is contained in:
soul-walker 2024-03-25 18:19:31 +08:00
parent 5045f6152a
commit 202037ec55
3 changed files with 30 additions and 13 deletions

View File

@ -2,7 +2,7 @@ name: 公网服务发布
run-name: ${{ gitea.actor }} is testing out Gitea Actions run-name: ${{ gitea.actor }} is testing out Gitea Actions
on: on:
schedule: schedule:
- cron: '*/5 * * * *' # 最多每5分钟执行一次 - cron: '25 18 * * *' # 每天晚上19:15执行
jobs: jobs:
Docker-Build-Push: Docker-Build-Push:
@ -10,14 +10,25 @@ jobs:
steps: steps:
- name: 测试定时执行任务 - name: 测试定时执行任务
run: echo "测试定时执行任务" run: echo "测试定时执行任务"
# - name: 发布到本地测试环境 - name: 发布到正式环境1
# uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3 uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
# with: with:
# host: ${{ secrets.LOCAL_233_SSH_HOST }} host: ${{ secrets.PUB1_DOMAIN_SSH_HOST }}
# port: ${{ secrets.LOCAL_233_SSH_PORT }} port: ${{ secrets.PUB1_DOMAIN_SSH_PORT }}
# username: ${{ secrets.LOCAL_233_SSH_USER }} username: ${{ secrets.PUB1_DOMAIN_SSH_USER }}
# password: ${{ secrets.LOCAL_233_SSH_PASSWORD }} password: ${{ secrets.PUB1_DOMAIN_SSH_PASSWORD }}
# script: | script: |
# docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist" docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
# docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
# docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=prd -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:latest docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:latest
- name: 发布到正式环境2
uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.PUB2_DOMAIN_SSH_HOST }}
port: ${{ secrets.PUB2_DOMAIN_SSH_PORT }}
username: ${{ secrets.PUB2_DOMAIN_SSH_USER }}
password: ${{ secrets.PUB2_DOMAIN_SSH_PASSWORD }}
script: |
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
docker pull gitea.joylink.club/joylink/rt-sim-training-service:latest
docker run --name rt-sim-training-service -it -u root --restart=always -d -e APP_ENV=prd -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:latest

View File

@ -55,4 +55,7 @@ jobs:
script: | script: |
docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist" docker rm -f rt-sim-training-service || echo "rt-sim-training-service not exist"
docker pull gitea.joylink.club/joylink/rt-sim-training-service:local-test docker pull gitea.joylink.club/joylink/rt-sim-training-service:local-test
docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=local-test -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:local-test docker run --name rt-sim-training-service --restart=always --network net --ip 192.168.53.3 -d -e APP_ENV=local-test -p 9000:9000 -p 19000:19000 -v /usr/local/joylink/logs/rtss:/usr/local/joylink/logs/rtss gitea.joylink.club/joylink/rt-sim-training-service:local-test
- name: 清理tag为none的镜像
run: |
docker rmi $(docker images --filter "dangling=true" -q)

View File

@ -45,6 +45,9 @@ jobs:
tags: | tags: |
gitea.joylink.club/joylink/rt-sim-training-service:${{ github.event.release.tag_name }} gitea.joylink.club/joylink/rt-sim-training-service:${{ github.event.release.tag_name }}
gitea.joylink.club/joylink/rt-sim-training-service:latest gitea.joylink.club/joylink/rt-sim-training-service:latest
- name: 清理tag为none的镜像
run: |
docker rmi $(docker images --filter "dangling=true" -q)
# - name: 发布到本地测试环境 # - name: 发布到本地测试环境
# uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3 # uses: https://gitea.joylink.club/appleboy/ssh-action@v1.0.3
# with: # with: