Files
NestQuest/deploy/pwa/Dockerfile
T
overseerandClaude Opus 5.5 13e3796d26 Feature 24: commit the admin PWA hosting artifacts and runbook section
Make the live admin PWA deployment reproducible from the repository:

- deploy/pwa/Dockerfile: multi-stage build (node:22-alpine builds admin/
  with the VITE_* build args, failing fast if any is empty; nginx:alpine
  pinned to the digest running on the API box serves dist/).
- deploy/pwa/Dockerfile.dockerignore: limits the repo-root context to
  admin/ sources and nginx.conf (the root .dockerignore excludes deploy/).
- deploy/pwa/nginx.conf: SPA fallback to index.html, root-served
  /sw.js and /manifest.webmanifest, allow-list 10.60.1.33 and
  10.60.1.14 only.
- deploy/compose.yaml: pwa service on NESTQUEST_BIND_ADDRESS:8081 with
  the build args from deploy/.env; api and litestream unchanged.
- deploy/.env.example: the three public PWA build values.
- deploy/RUNBOOK.md: section 10 (PWA build/serve, nestquest-app Traefik
  router, verification) and the router priorities in section 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 12:21:53 -04:00

30 lines
1.2 KiB
Docker

# Admin PWA image (Feature 24): builds the Vite bundle from admin/ and
# serves it with nginx. Build context is the REPOSITORY ROOT (it needs
# admin/); deploy/pwa/Dockerfile.dockerignore limits that context to
# admin/ and this directory's nginx.conf.
#
# docker compose -f deploy/compose.yaml build pwa
#
# The VITE_* values are baked into the bundle at build time. None is a
# secret (the OIDC client is a public PKCE client), and all three are
# required: the build fails fast rather than relying on app defaults.
FROM node:22-alpine@sha256:0a7108bf6c7bf5de370ffb1a3ed6be93d405b43ff159f681a8d18c0e2bc2e402 AS build
ARG VITE_AUTHENTIK_CLIENT_ID
ARG VITE_AUTHENTIK_ISSUER
ARG VITE_API_BASE_URL
WORKDIR /src/admin
COPY admin/package.json admin/package-lock.json ./
RUN npm ci
COPY admin/ ./
RUN test -n "$VITE_AUTHENTIK_CLIENT_ID" && test -n "$VITE_AUTHENTIK_ISSUER" && test -n "$VITE_API_BASE_URL" \
|| { echo "VITE_AUTHENTIK_CLIENT_ID, VITE_AUTHENTIK_ISSUER and VITE_API_BASE_URL build args are required" >&2; exit 1; }
RUN npm run build
FROM nginx:alpine@sha256:1ed1b0e1d7652937d6cbdaf4018c7b6fc009a7dd6c3047351e2eddda745de43f
COPY deploy/pwa/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/admin/dist/ /usr/share/nginx/html/