# Multi-stage build: # 1. node:alpine — install + vite build → dist/ # 2. nginx:alpine — serve dist/ + reverse-proxy /api/ to the backend # # Build args: # VITE_DIALECTIC_API_BASE — defaults to '/api' (same-origin via nginx) # VITE_OIDC_DEV_BYPASS — set to a token string to bake dev-bypass # into the bundle (DO NOT set in prod images) FROM node:22-alpine AS build WORKDIR /app COPY package.json package-lock.json* ./ RUN npm ci --no-audit --no-fund COPY . . ARG VITE_DIALECTIC_API_BASE=/api ARG VITE_OIDC_DEV_BYPASS= ENV VITE_DIALECTIC_API_BASE=$VITE_DIALECTIC_API_BASE ENV VITE_OIDC_DEV_BYPASS=$VITE_OIDC_DEV_BYPASS RUN npm run build FROM nginx:1.27-alpine AS serve COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -qO- http://127.0.0.1/index.html >/dev/null || exit 1