# syntax=docker/dockerfile:1 # # Web image: builds the Vite static bundle and serves it with nginx, which also # reverse-proxies /api to the api service. # # NOTE: build MUST be glibc/amd64 (see Dockerfile.api for the reason). The # vite.config.ts requires PORT and BASE_PATH to be set even for `build`. # ---- Build stage ----------------------------------------------------------- FROM --platform=linux/amd64 node:24-bookworm-slim AS build ENV PNPM_HOME=/pnpm ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable && corepack prepare pnpm@10.32.1 --activate WORKDIR /repo COPY . . RUN pnpm install --no-frozen-lockfile # PORT + BASE_PATH are required by vite.config.ts at config load time. RUN PORT=8080 BASE_PATH=/ NODE_ENV=production pnpm --filter @workspace/ehsan-poc run build # ---- Runtime stage --------------------------------------------------------- # The glibc/amd64 constraint applies only to the BUILD stage (node native deps). # The runtime just serves static files, so the lightweight nginx:alpine is fine. FROM --platform=linux/amd64 nginx:1.27-alpine AS runtime COPY docker/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build /repo/artifacts/ehsan-poc/dist/public /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]