fix(deploy): use container IP dynamically for build-info health check in CI runner
Some checks failed
CI / Lint, Test & Build (push) Successful in 12m4s
CI / Deploy production (on server) (push) Failing after 3m58s

This commit is contained in:
Antigravity
2026-05-21 18:54:09 +00:00
parent f38e08e289
commit 55fb081e94

View File

@@ -75,8 +75,16 @@ fi
nginx -t 2>/dev/null && systemctl reload nginx 2>/dev/null || true
CONTAINER_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' memento-note 2>/dev/null || true)
for i in $(seq 1 24); do
BODY=$(curl -sf --max-time 3 http://127.0.0.1:3000/api/build-info 2>/dev/null || true)
BODY=""
if [ -n "$CONTAINER_IP" ]; then
BODY=$(curl -sf --max-time 3 "http://${CONTAINER_IP}:3000/api/build-info" 2>/dev/null || true)
fi
if [ -z "$BODY" ]; then
BODY=$(curl -sf --max-time 3 http://127.0.0.1:3000/api/build-info 2>/dev/null || true)
fi
ACTUAL=$(echo "$BODY" | jq -r '.commit // empty' 2>/dev/null || true)
if [ "$ACTUAL" = "$GIT_COMMIT" ]; then
echo "OK build-info commit=$ACTUAL"