--- phase: quick plan: 260329-x2a subsystem: deployment tags: [docker, deployment, containerization] dependency_graph: requires: [] provides: [docker-image, containerized-deployment] affects: [] tech_stack: added: [node:22-alpine, Docker multi-stage build] patterns: [multi-stage Docker build, Vite preview server in container] key_files: created: - Dockerfile - .dockerignore modified: [] decisions: - "All deps are devDependencies (vite, typescript etc.) so serve stage uses npm ci without --omit=dev to have vite available for vite preview" - "config.json override via volume mount to dist/config.json (Vite preview serves dist/)" - "vite.config.ts copied into serve stage so vite preview can read host/port config" metrics: duration: "<1min" completed: "2026-03-29" tasks: 1 files: 2 --- # Quick Task 260329-x2a: Dockerfile and .dockerignore for Zauberwald **One-liner:** Multi-stage Docker build (node:22-alpine) with Vite preview server on port 4173 and runtime config.json override via volume mount. ## Tasks Completed | Task | Name | Commit | Files | |------|------|--------|-------| | 1 | Create Dockerfile and .dockerignore | 3f5fc0f | Dockerfile, .dockerignore | ## What Was Built **Dockerfile** — Two-stage build: - Stage 1 (`build`): `node:22-alpine`, installs all deps with `npm ci`, copies source, runs `npm run build` (tsc + vite build) producing `dist/` - Stage 2 (`serve`): `node:22-alpine`, installs all deps again (needed for `vite preview`), copies `dist/` and `vite.config.ts` from build stage, exposes port 4173, runs `npm run preview` **.dockerignore** — Excludes `node_modules`, `dist`, `.git`, `.planning`, `*.md`, `.biome`, `.claude`, `.agents` from build context. ## Usage ```bash # Build the image docker build -t zauberwald . # Run with config.json mounted from host docker run -v /path/to/config.json:/app/dist/config.json:ro -p 4173:4173 zauberwald ``` The app is then accessible at `http://localhost:4173`. ## Key Decisions - All project dependencies are `devDependencies` (vite, typescript, etc.). The serve stage must run `npm ci` (without `--omit=dev`) so that `vite` is available for `npm run preview`. - `public/config.json` is intentionally NOT excluded from `.dockerignore` — it must be baked into `dist/` during build. At runtime, users can override it by mounting their own `config.json` to `/app/dist/config.json`. - `vite.config.ts` is copied into the serve stage because Vite reads it to apply the `host: "0.0.0.0"` and `port: 4173` preview settings. ## Deviations from Plan None — plan executed exactly as written. ## Self-Check: PASSED - Dockerfile exists: FOUND - .dockerignore exists: FOUND - Commit 3f5fc0f exists: FOUND - EXPOSE 4173 in Dockerfile: FOUND - node_modules in .dockerignore: FOUND