# Stage 1: Build the application FROM node:20-slim as builder WORKDIR /app # Copy package files and install dependencies COPY package*.json ./ RUN npm install # Copy source code COPY . . # Build the application RUN npm run build # Stage 2: Serve the application with Nginx FROM nginx:alpine # Copy the build output from the builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy custom Nginx configuration COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]