# Two-stage build: vite static build → nginx serving dist/.
# Image is intended to be pushed to gitea.flow-master.ai/shad/mission-control-demo
# and referenced from FM06/flowmaster-ops manifests/overlays/demo/mc-deployment.yaml.

FROM node:22-alpine AS build
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare pnpm@latest --activate \
  && pnpm install --frozen-lockfile
COPY . .
RUN pnpm build

FROM nginx:1.27-alpine
COPY --from=build /app/dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
  CMD wget -q --spider http://127.0.0.1/ || exit 1
