[PROMOTE] 晉升 dev 至 demo

1. [FEAT] 調整生產環境部署流程的容器健康檢查等待邏輯與清理策略
This commit is contained in:
sky121113 2026-06-03 17:45:41 +08:00
commit 68242fd22a

View File

@ -33,7 +33,28 @@ jobs:
- name: Step 1 - Build & Deploy Containers
run: |
WWWGROUP=1001 WWWUSER=1001 docker-compose up -d --build --wait
WWWGROUP=1001 WWWUSER=1001 docker-compose up -d --build
for container in star-cloud-mysql star-cloud-redis star-cloud-emqx; do
echo ">>> Waiting for ${container} to become healthy..."
for i in $(seq 1 60); do
status=$(docker inspect -f '{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}' "${container}" 2>/dev/null || echo "missing")
if [ "${status}" = "healthy" ]; then
echo ">>> ${container} is healthy."
break
fi
if [ "${i}" -eq 60 ]; then
echo ">>> ${container} did not become healthy. Current status: ${status}"
docker logs --tail 80 "${container}" || true
exit 1
fi
sleep 2
done
done
- name: Step 2 - Deploy Code
run: |
@ -75,4 +96,4 @@ jobs:
echo "✅ MQTT Worker 已重啟"
- name: Step 5 - Cleanup
run: docker image prune -f
run: docker image prune -f --filter "until=168h"