# Build stage FROM node:18-alpine as build WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies (use npm install instead of npm ci for better compatibility) RUN npm install --only=production --no-optional # Copy source code COPY . . # Build the application RUN npm run build # Production stage FROM nginx:alpine # Copy built application COPY --from=build /app/build /usr/share/nginx/html # Copy nginx configuration COPY nginx.conf /etc/nginx/nginx.conf # Expose port EXPOSE 3000 # Health check HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ CMD curl -f http://localhost:3000 || exit 1 # Start nginx CMD ["nginx", "-g", "daemon off;"]