# Build stage FROM node:20-alpine AS build WORKDIR /app COPY package.json package-lock.json* ./ RUN npm install COPY . . RUN npm run build # Runtime stage FROM node:20-alpine RUN npm install -g serve@14 WORKDIR /app COPY --from=build /app ./ ENV FRONTEND_DEV_MODE=0 # OIDC-only mode flag. The SPA's effective behavior is driven at runtime by # the backend's public GET /auth/config (single source of truth); this # build/runtime arg is declared so the frontend image carries the same knob. ARG HARBORFORGE_OIDC_ONLY=false ENV HARBORFORGE_OIDC_ONLY=${HARBORFORGE_OIDC_ONLY} EXPOSE 3000 CMD ["sh", "-c", "if [ \"$FRONTEND_DEV_MODE\" = \"1\" ]; then npm run dev -- --host 0.0.0.0 --port 3000 --strictPort; else serve -s dist -l 3000; fi"]