# Static build served by nginx. VITE_BITRIX_ORIGIN must be provided at build
# time (build arg) — it gets baked into the JS bundle, see docs/bitrix-integration.md §7.
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ARG VITE_BITRIX_ORIGIN
ENV VITE_BITRIX_ORIGIN=$VITE_BITRIX_ORIGIN
RUN npm run build

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