# Stage 1: Build the frontend FROM node:20 AS builder WORKDIR /app COPY . . RUN npm install RUN npm run build # Stage 2: Serve with nginx FROM nginx:alpine # Copy built app COPY --from=builder /app/dist /usr/share/nginx/html # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy the runtime env template + entrypoint COPY public/env.js.template /usr/share/nginx/html/env.js.template COPY docker-entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh EXPOSE 80 ENTRYPOINT ["/entrypoint.sh"]