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:
+13
-11
@@ -44,18 +44,20 @@ jobs:
|
|||||||
-e TWITCH_CLIENT_SECRET='${{ secrets.TWITCH_CLIENT_SECRET }}' \
|
-e TWITCH_CLIENT_SECRET='${{ secrets.TWITCH_CLIENT_SECRET }}' \
|
||||||
${{ env.IMAGE_NAME }}:latest
|
${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
||||||
- name: Wait for health check
|
- name: Verify container is running
|
||||||
run: |
|
run: |
|
||||||
for i in $(seq 1 30); do
|
sleep 5
|
||||||
if curl -sf http://localhost:${{ env.HOST_PORT }}/api/health >/dev/null 2>&1; then
|
STATUS=$(docker inspect -f '{{.State.Status}}' ${{ env.CONTAINER_NAME }})
|
||||||
echo "✅ Dostalgia is running!"
|
if [ "$STATUS" = "running" ]; then
|
||||||
exit 0
|
echo "✅ Dostalgia container is running"
|
||||||
fi
|
echo "--- last logs ---"
|
||||||
sleep 2
|
docker logs ${{ env.CONTAINER_NAME }} --tail 5
|
||||||
done
|
echo "✅ Dostalgia deployed!"
|
||||||
echo "❌ Health check failed"
|
else
|
||||||
docker logs ${{ env.CONTAINER_NAME }} --tail 20
|
echo "❌ Container status: $STATUS"
|
||||||
exit 1
|
docker logs ${{ env.CONTAINER_NAME }} --tail 30
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Clean up old images
|
- name: Clean up old images
|
||||||
run: docker image prune -f --filter "until=24h"
|
run: docker image prune -f --filter "until=24h"
|
||||||
|
|||||||
Reference in New Issue
Block a user