Repository navigation
Description
Task
T-116· Milestone M8 — Dashboard · Size S · Priority P0 · Epic #8Implements NFR-DEP-001 · NFR-SEC-001
Branch
ci/t-116-web-production-image-nginx-non— one task = one branch = one PR (doc 32 §6)
Summary
Create docker/web/Dockerfile (pnpm build → nginx-unprivileged), nginx.conf (SPA fallback, /api reverse proxy with SSE buffering off, gzip/brotli static, cache headers for hashed assets), strict CSP / X-Content-Type-Options / Referrer-Policy / frame-ancestors headers, /config.json generated from env at container start, and the compose web service (app profile).
Context / motivation
Doc 17 §5 / doc 29: one-command deployment; CSP mitigates XSS (TM-05).
Scope
In scope
- Healthcheck; read-only root FS compatible.
Implementation guidance
docker/web/Dockerfile: stage 1node:22-alpine+ corepack pnpm,pnpm install --frozen-lockfile,pnpm build; stage 2nginxinc/nginx-unprivilegedpinned by digest serving/usr/share/nginx/htmlon 8080 as non-root.- Entrypoint hook
docker/web/40-config-json.sh(nginxdocker-entrypoint.d) writes/config.jsonfromROBOPROBE_WEB_API_BASE_URL,ROBOPROBE_WEB_SSE_URL,ROBOPROBE_WEB_DEFAULT_THEME,ROBOPROBE_WEB_FEATURES(doc 27 §4.11) into a tmpfs-backed path (read-only root FS compatible). nginx.conf: SPA fallbacktry_files $uri /index.html;location /api/→proxy_pass http://api:8000withproxy_http_version 1.1;proxy_buffering offandproxy_read_timeout 1hfor/api/v1/events; gzip for text assets;Cache-Control: public, max-age=31536000, immutablefor hashed/assets/*,no-cacheforindex.html/config.json.- Security headers:
Content-Security-Policy: default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; connect-src 'self'; frame-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'none'(Plotly requires inline styles — document why),X-Content-Type-Options: nosniff,Referrer-Policy: no-referrer, minimalPermissions-Policy. - Compose
webservice (profileapp): port${ROBOPROBE_WEB_PORT:-8080},depends_onapi healthy, healthcheckwget -qO- http://localhost:8080/. - Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff
PLR2004); public APIs typed (mypy strict) and documented.
Configuration keys
From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).
ROBOPROBE_WEB_API_BASE_URLROBOPROBE_WEB_SSE_URLROBOPROBE_WEB_DEFAULT_THEMEROBOPROBE_WEB_FEATURESROBOPROBE_WEB_PORT
Acceptance criteria
-
docker compose --profile app upserves the dashboard at the configured port; SSE works through nginx. - Security headers verified by a curl test in CI.
- CSP produces no violations on any route in E2E (console listener asserts).
- Image runs with
read_only: true. - Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
- CI smoke job: build image, curl headers, SSE through proxy.
Dependencies
Blocked by: #165 (T-085d), #27 (T-005b)
Blocks: #186 (T-117), #189 (T-119), #219 (T-127)
Parallelization notes
Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:
docker/web/**- docker/compose.yaml (web service block)
Infra-only; compose edit append-only.
Definition of Done
Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-116 (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.
References
Design docs: doc 17 §5 · doc 17 §4 · doc 29 §3 · doc 21 §1 · doc 30 §RB-06 · doc 27 §4.11 · doc 27 §4.12
Requirements: NFR-DEP-001 · NFR-SEC-001 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
/config.json), SSE client with reconnect/Last-Event-ID and query-cache patching #165coreprofile: Postgres 17 with secrets, migrate placeholder, make up/down/db-up #27e2e.ymlworkflow #186images.yml: build & push to GHCR, Trivy scan, SBOM (Syft), provenance #189feat(docker): web nginx image, CSP headers, compose web (T-116)
fix(docker): make the production dashboard deployable (T-116) (#329)