Add healthcheck support to Dockerfile

- 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 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-21 23:40:06 +07:00
parent 7a493d0e9c
commit 967dd206fa

View File

@@ -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"]