# TEMPLATE, not built for this book (no container runtime was available in the writing environment).
# Two-stage build: compile with the full toolchain, run with only what the server needs.
FROM node:22-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
COPY . .
RUN npx ng build site

FROM node:22-slim
WORKDIR /app
ENV NODE_ENV=production PORT=4000
# Set to the public host names. See ADR-009.
ENV NG_ALLOWED_HOSTS=harbor.example
COPY --from=build /app/dist/site ./dist/site
COPY --from=build /app/package.json ./package.json
USER node
EXPOSE 4000
CMD ["node", "dist/site/server/server.mjs"]
