# Production image for the publisher SPA (frontend_publisher). # Multi-stage: build the minified bundle in the npm workspace, then serve it with nginx. # The runtime image holds ONLY static files — no Node, no source, no Vite dev server. # # Build context = repo ROOT (the npm workspace): # docker build -f frontend_publisher/Dockerfile.prod -t frontend_publisher . # ---- build stage ---- FROM node:22-alpine AS build WORKDIR /app # Workspace manifests first (layer cache); all are needed for `npm ci` to resolve. COPY package.json package-lock.json ./ COPY shared/package.json ./shared/ COPY frontend_user/package.json ./frontend_user/ COPY frontend_admin/package.json ./frontend_admin/ COPY frontend_investigator/package.json ./frontend_investigator/ COPY frontend_publisher/package.json ./frontend_publisher/ RUN npm ci # Only the sources this app needs: the publisher app + the shared kernel (consumed as source). COPY shared ./shared COPY frontend_publisher ./frontend_publisher # Vite production build → /app/frontend_publisher/dist (minified, sourcemap:false). RUN npm run build -w frontend_publisher # ---- runtime stage (static only) ---- FROM nginx:1.27-alpine RUN rm -rf /usr/share/nginx/html/* COPY frontend_publisher/nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/frontend_publisher/dist /usr/share/nginx/html EXPOSE 8080 CMD ["nginx", "-g", "daemon off;"]