# Built on the build machine's own platform; the image only holds the static files and nginx.
FROM --platform=$BUILDPLATFORM node:24-alpine AS build
WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY . .
# The release tag, shown in the Stan screen; the release workflow passes it.
ARG VERSION=dev
ENV VERSION=$VERSION
# Tests run in scripts/check.sh; they read the API contract from backend/, outside this context.
RUN npm run build

FROM nginxinc/nginx-unprivileged:1.29-alpine
COPY nginx.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /src/dist /usr/share/nginx/html
ENV BACKEND_URL=http://backend:8080
EXPOSE 8080
