Fix workflow health check: docker inspect instead of localhost curl (runner can't reach host's localhost)
Build & Deploy / build-and-deploy (push) Successful in 15s
Build & Deploy / build-and-deploy (push) Successful in 15s
This commit is contained in:
+12
-10
@@ -44,18 +44,20 @@ jobs:
|
||||
-e TWITCH_CLIENT_SECRET='${{ secrets.TWITCH_CLIENT_SECRET }}' \
|
||||
${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Wait for health check
|
||||
- name: Verify container is running
|
||||
run: |
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf http://localhost:${{ env.HOST_PORT }}/api/health >/dev/null 2>&1; then
|
||||
echo "✅ Dostalgia is running!"
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "❌ Health check failed"
|
||||
docker logs ${{ env.CONTAINER_NAME }} --tail 20
|
||||
sleep 5
|
||||
STATUS=$(docker inspect -f '{{.State.Status}}' ${{ env.CONTAINER_NAME }})
|
||||
if [ "$STATUS" = "running" ]; then
|
||||
echo "✅ Dostalgia container is running"
|
||||
echo "--- last logs ---"
|
||||
docker logs ${{ env.CONTAINER_NAME }} --tail 5
|
||||
echo "✅ Dostalgia deployed!"
|
||||
else
|
||||
echo "❌ Container status: $STATUS"
|
||||
docker logs ${{ env.CONTAINER_NAME }} --tail 30
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Clean up old images
|
||||
run: docker image prune -f --filter "until=24h"
|
||||
|
||||
Reference in New Issue
Block a user