# Build the admin SPA, then serve it with nginx. nginx also reverse-proxies
# /admin and /api to the backend container so the whole stack is reachable
# through a single origin (no CORS hassle in production).

FROM node:22-bookworm-slim AS builder
WORKDIR /src
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:1.27-bookworm
COPY --from=builder /src/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
