# Stage 1 — build FROM node:20-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci --silent COPY . . # Use production env if present, otherwise fall back to defaults RUN [ -f .env.production ] && cp .env.production .env || true RUN npm run build # Stage 2 — serve FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80