diff --git a/scripts/deploy-prod.sh b/scripts/deploy-prod.sh index af6e362..c228970 100755 --- a/scripts/deploy-prod.sh +++ b/scripts/deploy-prod.sh @@ -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"