fix(ci): use retry loop for frontend health check
Some checks failed
Deploy to Production / deploy (push) Failing after 3m32s

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 <noreply@anthropic.com>
This commit is contained in:
zephyrdark 2026-02-07 23:58:06 +09:00
parent f43f26f43c
commit e22241dbc4

View File

@ -42,8 +42,15 @@ jobs:
- name: Health check - name: Health check
run: | run: |
echo "Waiting for services to start..." echo "Waiting for all containers to become healthy..."
sleep 20 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 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; } 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" echo "Backend: OK"