# ---- build ----
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --legacy-peer-deps
COPY . .
# Kendo Angular license: passed in as a build-arg (sourced from a Gitea Actions
# secret), exposed to `npm run build` as the env var kendo-licensing reads. Not
# baked into any image layer beyond this build stage (the runtime stage is nginx).
ARG KENDO_UI_LICENSE
ENV KENDO_UI_LICENSE=${KENDO_UI_LICENSE}
RUN npm run build           # -> dist/client-bridge/browser  (production by default)

# ---- runtime ----
FROM nginx:alpine AS final
COPY nginx.app.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist/client-bridge/browser /usr/share/nginx/html
EXPOSE 80
