# --- STAGE 1: Build --- FROM node:20-alpine AS builder WORKDIR /app # Install dependencies COPY package.json package-lock.json ./ RUN npm install --legacy-peer-deps # Copy source and build COPY . . RUN npm run build # --- STAGE 2: Runtime --- FROM nginx:alpine # Copy built assets from builder stage COPY --from=builder /app/dist /usr/share/nginx/html # Copy custom nginx config for SPA routing COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 # Nginx starts automatically CMD ["nginx", "-g", "daemon off;"]