# syntax=docker/dockerfile:1 # Shared Dockerfile for the 3 EDEN frontends (core-web, reseller-web, # subscriber-web). Parametrized by APP_NAME. Builds static assets with Vite, # serves them with nginx (SPA fallback to index.html — see nginx-spa.conf). FROM node:22-slim AS build RUN corepack enable WORKDIR /repo COPY . . RUN pnpm install --frozen-lockfile ARG APP_NAME # Vite bakes VITE_-prefixed vars into the bundle at build time (no runtime # env in a static nginx-served SPA) — see docs/adr/0002 + compose.yaml's # build.args for each of the 3 frontends. Default is same-origin relative # path: the API is never exposed on its own public domain (operator # decision), so in production the reverse proxy in front of each public # frontend domain must forward this path (e.g. /api/*) to eden-api on the # internal network — see the comment on EDEN_CORS_ORIGINS in .env.example. ARG VITE_API_BASE_URL=/api/v1 ENV VITE_API_BASE_URL=${VITE_API_BASE_URL} RUN pnpm turbo run build --filter=@eden/${APP_NAME}... FROM nginx:1.27-alpine AS runtime ARG APP_NAME COPY infra/docker/nginx-spa.conf /etc/nginx/conf.d/default.conf COPY --from=build /repo/apps/${APP_NAME}/dist /usr/share/nginx/html EXPOSE 80