# Multi-stage Dockerfile for the email-editor microservice. # Stage 1: Vite build into dist/ # Stage 2: nginx serving the static files # ── Stage 1: build ── FROM node:20-alpine AS builder WORKDIR /app # Install only what's needed for build (no native deps required) COPY package.json package-lock.json* ./ RUN npm install --silent COPY tsconfig.json vite.config.ts index.html ./ COPY src ./src # Inline the prod hub URL at build time. Override via --build-arg on docker # build if running against a different hub (e.g. staging). ARG VITE_HUB_URL=https://msg.gigafibre.ca ENV VITE_HUB_URL=$VITE_HUB_URL RUN npm run build # ── Stage 2: nginx serve ── FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html # Drop the default nginx config and inject a minimal SPA-friendly one # (all routes serve index.html — easy-email is a SPA, query params drive # which template to load). RUN rm /etc/nginx/conf.d/default.conf COPY <