# Build stage FROM node:20-alpine AS builder WORKDIR /app # Install dependencies COPY package*.json ./ RUN npm install # Copy source COPY . . # Build RUN npm run build # Production stage FROM nginx:alpine # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy build artifacts COPY --from=builder /app/dist /usr/share/nginx/html # Create logs directory RUN mkdir -p /var/log/nginx # Expose port EXPOSE 80 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD curl -f http://localhost/ || exit 1 CMD ["nginx", "-g", "daemon off;"]