# Build context is the repository root:
#   docker build -f deploy/Dockerfile --build-arg COURSE_HOST=course.example.com .
FROM node:22-alpine AS build
ARG COURSE_HOST
RUN test -n "$COURSE_HOST" || (echo "COURSE_HOST build arg is required" >&2; exit 1)
ENV COURSE_HOST=$COURSE_HOST
WORKDIR /app
COPY . ./
RUN npm --prefix site ci --no-audit --no-fund
RUN npm --prefix site run build

FROM nginx:alpine
COPY --from=build /app/site/dist /usr/share/nginx/html
EXPOSE 80
