# ── Stage 1: Build ────────────────────────────────────────────── FROM node:22-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build # ── Stage 2: Serve ────────────────────────────────────────────── FROM nginx:stable-alpine # Remove default nginx static assets RUN rm -rf /usr/share/nginx/html/* # Copy built output from builder COPY --from=builder /app/dist /usr/share/nginx/html # nginx config — SPA-friendly: route all 404s back to index.html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]