# syntax=docker/dockerfile:1 # # API server image (Express, esbuild bundle). # # NOTE: the pnpm-workspace `overrides` strip every native binary that is not # linux-x64-gnu (no musl, no arm64, no darwin). The image therefore MUST be a # glibc/amd64 image — use node:*-bookworm-slim (NOT alpine) and build for # linux/amd64 (Docker on Apple Silicon runs this under emulation/Rosetta). # ---- 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@9 --activate WORKDIR /repo COPY . . RUN pnpm install --frozen-lockfile RUN NODE_ENV=production pnpm --filter @workspace/api-server run build # ---- Runtime stage --------------------------------------------------------- FROM --platform=linux/amd64 node:24-bookworm-slim AS runtime ENV NODE_ENV=production WORKDIR /app # esbuild produces a self-contained bundle (index.mjs + pino transport files). COPY --from=build /repo/artifacts/api-server/dist ./dist # PORT is supplied by docker-compose (defaults there to 8080). EXPOSE 8080 CMD ["node", "--enable-source-maps", "dist/index.mjs"]