This commit is contained in:
@@ -224,16 +224,21 @@ jobs:
|
|||||||
echo "⏳ Waiting for services to be healthy..."
|
echo "⏳ Waiting for services to be healthy..."
|
||||||
MAX_RETRIES=12
|
MAX_RETRIES=12
|
||||||
RETRY_COUNT=0
|
RETRY_COUNT=0
|
||||||
until curl -s -f http://localhost:3000/health > /dev/null || [ \$RETRY_COUNT -eq \$MAX_RETRIES ]; do
|
until curl -s -f http://127.0.0.1:3000/health > /dev/null || [ \$RETRY_COUNT -eq \$MAX_RETRIES ]; do
|
||||||
echo " • Waiting for health check... (\$((RETRY_COUNT + 1))/\$MAX_RETRIES)"
|
echo " • Waiting for health check... (\$((RETRY_COUNT + 1))/\$MAX_RETRIES)"
|
||||||
|
# Log the output of curl for debugging if it fails
|
||||||
|
curl -v http://127.0.0.1:3000/health 2>&1 | grep -E "< HTTP/|* Connection" || true
|
||||||
sleep 5
|
sleep 5
|
||||||
RETRY_COUNT=\$((RETRY_COUNT + 1))
|
RETRY_COUNT=\$((RETRY_COUNT + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ \$RETRY_COUNT -eq \$MAX_RETRIES ]; then
|
if [ \$RETRY_COUNT -eq \$MAX_RETRIES ]; then
|
||||||
echo "❌ Health check failed after \$MAX_RETRIES retries"
|
echo "❌ Health check failed after \$MAX_RETRIES retries"
|
||||||
|
echo "🔍 Container status:"
|
||||||
|
docker-compose ps
|
||||||
|
echo ""
|
||||||
echo "🔍 Container logs:"
|
echo "🔍 Container logs:"
|
||||||
docker-compose logs --tail=50
|
docker-compose logs --tail=100
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM node:20-alpine AS base
|
|||||||
# Install dependencies only when needed
|
# Install dependencies only when needed
|
||||||
FROM base AS deps
|
FROM base AS deps
|
||||||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
||||||
RUN apk add --no-cache libc6-compat
|
RUN apk add --no-cache libc6-compat curl
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies based on the preferred package manager
|
# Install dependencies based on the preferred package manager
|
||||||
@@ -41,6 +41,9 @@ RUN npm run build
|
|||||||
FROM base AS runner
|
FROM base AS runner
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install curl for health checks
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
# Uncomment the following line in case you want to disable telemetry during runtime.
|
# Uncomment the following line in case you want to disable telemetry during runtime.
|
||||||
# ENV NEXT_TELEMETRY_DISABLED 1
|
# ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"]
|
test: ["CMD-SHELL", "curl -f http://127.0.0.1:3000/health || exit 1"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user