feat: 后台打包测试部署
Some checks failed
Backend Deploy (Go + Docker) / deploy (push) Failing after 57s

This commit is contained in:
zs
2026-03-02 21:54:24 +08:00
parent 9c875afc95
commit c0edfb629b

View File

@@ -40,7 +40,7 @@ jobs:
HOST: 144.24.60.0
KEY: ${{secrets.USAARMLOGIN_SSH_KEY}}
ARGS: -avz --delete
SSH_ARGS: "-p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
SSH_ARGS: "-p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=3"
SOURCE: ./deploy/
TARGET: /var/admin/InsightReply/server/
VERBOSE: true
@@ -54,7 +54,15 @@ jobs:
script: |
cd /var/admin/InsightReply/server
sync
sleep 5
# 检查是否有正在移除的容器,等待其完成
for i in {1..10}; do
if docker ps -a | grep -q "Removal In Progress"; then
echo "Waiting for container removal..."
sleep 2
# 先停止容器以避免移除冲突,然后重新构建并启动 (使用 V2 版本的 docker compose)
docker compose down || true
docker compose up -d --build
else
break
fi
done
# 使用 --remove-orphans 更彻底地清理,并直接 build up
docker compose up -d --build --remove-orphans