From 967dd206fade122b0b0e6082ebe6262aaff7f17a Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 21 Dec 2025 23:40:06 +0700 Subject: [PATCH] Add healthcheck support to Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Install curl for health check compatibility - Add built-in Docker healthcheck with proper timing - Include start-period to allow server to initialize - Fix Coolify deployment issues with health checks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a2073a..8524549 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,8 +19,8 @@ RUN npm run build # Production stage - Use a simple server that works with Coolify FROM node:18-alpine AS production -# Install serve package -RUN npm install -g serve +# Install curl and serve package +RUN apk add --no-cache curl && npm install -g serve # Set working directory WORKDIR /app @@ -39,5 +39,9 @@ USER nextjs # Expose port 3000 (Coolify default) EXPOSE 3000 +# Add healthcheck +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:3000/ || exit 1 + # Start the server CMD ["serve", "-s", "dist", "-l", "3000"] \ No newline at end of file