# 1. Build Stage FROM node:20-slim AS builder WORKDIR /app # Environment variables for build time # ENV NODE_ENV=production <- REMOVED: This causes npm ci to skip devDependencies (tsc, vite) # These must match the Nginx proxy paths ENV VITE_API_TARGET=/api ENV NEXT_PUBLIC_BACKEND_URL=/api/v1 COPY frontend/package.json frontend/package-lock.json ./ RUN npm ci COPY frontend/ . RUN npm run build # 2. Runtime Stage FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html COPY docker/nginx.prod.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]