From e22241dbc410ec82b3c1c3913d12d728eb631ad9 Mon Sep 17 00:00:00 2001 From: zephyrdark Date: Sat, 7 Feb 2026 23:58:06 +0900 Subject: [PATCH] fix(ci): use retry loop for frontend health check The frontend container needs more time to initialize. Replace fixed sleep with a retry loop that polls the container health status up to 30 times (150s max) before checking. Co-Authored-By: Claude Opus 4.6 --- .gitea/workflows/deploy.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 72a16d0..0a85a77 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -42,8 +42,15 @@ jobs: - name: Health check run: | - echo "Waiting for services to start..." - sleep 20 + echo "Waiting for all containers to become healthy..." + for i in $(seq 1 30); do + STATUS=$(docker inspect --format='{{.State.Health.Status}}' galaxis-po-frontend 2>/dev/null || echo "missing") + if [ "$STATUS" = "healthy" ]; then + break + fi + echo " frontend: $STATUS (attempt $i/30)" + sleep 5 + done docker compose --project-name galaxis-po --env-file .env.prod -f docker-compose.prod.yml ps docker exec galaxis-po-backend python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || { echo "Backend: FAILED"; exit 1; } echo "Backend: OK"