# Build from the REPO ROOT: podman build -f site/Dockerfile --ignorefile site/Dockerfile.dockerignore -t cli-site .
# Root context is required: the CLI release notes live in docs/release-notes/, and
# site/Dockerfile.dockerignore narrows the context to just what this needs.

FROM node:22-bookworm-slim AS build
ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /src/site
COPY site/package.json site/package-lock.json ./
RUN npm ci --no-audit --no-fund
# The app reads the CLI notes from ../docs/release-notes, so keep the repo's layout.
COPY docs/release-notes/ /src/docs/release-notes/
COPY site/ ./
# A release file the schema rejects fails here, before anything is published.
RUN npm run build

FROM nginxinc/nginx-unprivileged:1.29-alpine
COPY site/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/site/out/nginx-latest.conf /etc/nginx/conf.d/site.d/latest.conf
COPY --from=build /src/site/out/ /usr/share/nginx/html/
EXPOSE 8080
