From a61da35357b89a742a6f2ba8af293270f35811ed Mon Sep 17 00:00:00 2001 From: Dorian Date: Tue, 3 Feb 2026 00:22:04 +0000 Subject: [PATCH] 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 --- Dockerfile | 7 +++---- docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d601ed9..ba60d1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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;"] diff --git a/docker-compose.yml b/docker-compose.yml index 73829e7..a194a65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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