Use docker network for health check

This commit is contained in:
Zhi
2026-03-14 07:45:23 +00:00
parent 71e8cc4e6d
commit 3a9850cafb

View File

@@ -13,11 +13,11 @@ docker compose -f "$COMPOSE_FILE" down 2>/dev/null || true
echo "📦 Starting services..." echo "📦 Starting services..."
docker compose -f "$COMPOSE_FILE" up -d docker compose -f "$COMPOSE_FILE" up -d
# Wait for frontend to be ready # Wait for frontend to be ready (run curl inside docker network)
echo "⏳ Waiting for services..." echo "⏳ Waiting for services..."
MAX_RETRIES=30 MAX_RETRIES=30
RETRY_COUNT=0 RETRY_COUNT=0
until curl -s -o /dev/null -w "%{http_code}" http://frontend:3000/ | grep -q "200" || [ $RETRY_COUNT -eq $MAX_RETRIES ]; do until docker run --rm --network harborforgetest_test-network curlimages/curl -s -o /dev/null -w "%{http_code}" http://frontend:3000/ 2>/dev/null | grep -q "200" || [ $RETRY_COUNT -eq $MAX_RETRIES ]; do
echo " Waiting for frontend... ($RETRY_COUNT/$MAX_RETRIES)" echo " Waiting for frontend... ($RETRY_COUNT/$MAX_RETRIES)"
sleep 2 sleep 2
RETRY_COUNT=$((RETRY_COUNT+1)) RETRY_COUNT=$((RETRY_COUNT+1))