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:
@@ -19,8 +19,8 @@ RUN npm run build
|
|||||||
# Production stage - Use a simple server that works with Coolify
|
# Production stage - Use a simple server that works with Coolify
|
||||||
FROM node:18-alpine AS production
|
FROM node:18-alpine AS production
|
||||||
|
|
||||||
# Install serve package
|
# Install curl and serve package
|
||||||
RUN npm install -g serve
|
RUN apk add --no-cache curl && npm install -g serve
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
@@ -39,5 +39,9 @@ USER nextjs
|
|||||||
# Expose port 3000 (Coolify default)
|
# Expose port 3000 (Coolify default)
|
||||||
EXPOSE 3000
|
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
|
# Start the server
|
||||||
CMD ["serve", "-s", "dist", "-l", "3000"]
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||||
Reference in New Issue
Block a user