# Build stage. Node 22 (glibc) so nothing here depends on the host.
FROM node:22-slim AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# tsc --noEmit && vite build; the prebuild hook copies canvaskit.wasm into public/
RUN npm run build

# Runtime: static files only. The photo pipeline runs in the visitor's browser.
FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
