# Admin – byggs statiskt och serveras av nginx
FROM node:22-alpine AS builder
WORKDIR /build
RUN corepack enable
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml .npmrc ./
COPY tsconfig.base.json turbo.json ./
COPY packages ./packages
COPY apps/admin ./apps/admin
ARG VITE_API_BASE_URL=http://localhost:4000
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
RUN pnpm install --frozen-lockfile --filter @app/admin...
RUN pnpm --filter @app/admin build

FROM nginx:alpine AS runtime
COPY --from=builder /build/apps/admin/dist /usr/share/nginx/html
COPY infrastructure/docker/nginx-admin.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
