Fix health check - use curl instead of wget

Issues fixed:
1. Removed duplicate health check from Dockerfile (docker-compose overrides it)
2. Switched from wget to curl (more reliable in alpine)
3. Installed curl in the Docker image
4. Simplified health check command

The health check now properly tests if Nginx is serving content on port 7777.
Container should show as healthy after 40s start period.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Dorian
2026-02-03 00:22:04 +00:00
parent 38c322bfaf
commit a61da35357
2 changed files with 4 additions and 5 deletions

View File

@@ -18,6 +18,9 @@ RUN npm run build
# Production stage
FROM nginx:alpine
# Install curl for health checks
RUN apk add --no-cache curl
# Copy custom nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf
@@ -27,9 +30,5 @@ COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port 7777
EXPOSE 7777
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:7777/ || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -16,7 +16,7 @@ services:
labels:
- "com.centurylinklabs.watchtower.enable=true"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:7777/"]
test: ["CMD", "curl", "-f", "http://localhost:7777/"]
interval: 30s
timeout: 10s
retries: 3