fix: remove --wait flag causing premature deploy failure, use manual health loop
CI - Build & Test / Backend (.NET) (push) Successful in 28s
CI - Build & Test / Frontend (Vue/TS) (push) Successful in 18s
CI - Build & Test / Security Check (push) Successful in 4s

The docker compose --wait flag times out before postgres can
become healthy (start_period=30s). Replaced with explicit
poll loop (5s interval, up to 120s) that checks ps output
for unhealthy/starting states.
This commit is contained in:
2026-06-20 18:46:27 +02:00
parent 83e072bc27
commit baf4008d97
+18 -2
View File
@@ -214,12 +214,28 @@ jobs:
if [ -n '${SERVICE_ARG}' ]; then
echo '🚀 Deploying service: ${SERVICE_ARG}'
docker compose --env-file /tmp/nexus-deploy-env build ${BUILD_ARGS} ${SERVICE_ARG}
docker compose --env-file /tmp/nexus-deploy-env up -d --wait --force-recreate ${SERVICE_ARG}
docker compose --env-file /tmp/nexus-deploy-env up -d --force-recreate ${SERVICE_ARG}
else
echo '🚀 Deploying all services'
docker compose --env-file /tmp/nexus-deploy-env build ${BUILD_ARGS}
docker compose --env-file /tmp/nexus-deploy-env up -d --wait --force-recreate
docker compose --env-file /tmp/nexus-deploy-env up -d --force-recreate
fi
echo '⏳ Waiting for services to become healthy (up to 120s)...'
for i in \$(seq 1 24); do
STATUS=\$(docker compose --env-file /tmp/nexus-deploy-env ps -a 2>/dev/null | tail -n +2)
if echo \"\$STATUS\" | grep -q 'unhealthy\|starting'; then
echo \" [\$i/24] Waiting...\"
sleep 5
else
echo '✅ All containers running'
docker compose --env-file /tmp/nexus-deploy-env ps -a
exit 0
fi
done
echo '❌ Timeout waiting for services'
docker compose --env-file /tmp/nexus-deploy-env ps -a
docker compose --env-file /tmp/nexus-deploy-env logs --tail=20
exit 1
" < "${ENV_TMPFILE}"
echo "✅ Docker compose up completed"