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>
35 lines
559 B
Docker
35 lines
559 B
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
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
|
|
|
|
# Copy built assets from builder stage
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Expose port 7777
|
|
EXPOSE 7777
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|