# Multi-stage: build the static app, then serve it (plus proxy /api and /ws to the
# backend) with Caddy — reusing the same reverse-proxy design as the native macOS
# "supervised local production" setup (deploy/Caddyfile), just pointed at the `backend`
# container hostname instead of 127.0.0.1.
#
# The Caddyfile itself is runtime-mounted by docker-compose.yml (from
# deploy/docker/Caddyfile), not baked in here, so it can be tweaked without a rebuild.
FROM node:22-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM caddy:2-alpine
COPY --from=build /app/dist /srv
EXPOSE 80 443
