# maelstrom-ui — OpenViking Web Studio static frontend
# Built per finalized plan: inbox/ryan/2026-08-14-maelstrom-ui-deployment-plan.md (Option B)
#
# Source: volcengine/openviking upstream, subdirectory web-studio/, pinned to
# commit 3cd1d4e9acdfcc2567fd78da95339c3b18936c1c (2026-08-14).
# NOT vendored into this repo (GitOps manifests stay app-source-free) — the
# build context is the upstream web-studio/ directory checked out at that
# commit. Image built + pushed manually for this deployment; see
# system/inbox/agents/peter-parker/ for the build log if promoted to CI.
#
# Stage 1: build the SPA
FROM node:22-alpine AS build
WORKDIR /app
COPY web-studio/package.json web-studio/package-lock.json* web-studio/pnpm-lock.yaml* ./
RUN if [ -f pnpm-lock.yaml ]; then corepack enable && corepack prepare pnpm@latest --activate && pnpm install --no-frozen-lockfile && pnpm approve-builds --all || true; \
    else npm ci; fi
COPY web-studio/ .
RUN if [ -f pnpm-lock.yaml ]; then pnpm run build; else npm run build; fi

# Stage 2: serve with nginx, proxying /api/, /health, /ready to the openviking Service.
# /bot/ is deliberately NOT proxied (bot.enabled: false, defense-in-depth per plan §2).
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
