# Story: Containerfile Builds the Whole App Again **Phase:** `23_containerfile_build` · **Gate:** hermetic integration `tests/integration/test_containerfile_assets.py` + real `podman build` + image smoke (no Playwright suite — build/infrastructure phase, per the phase plan's A16 note) ## Narrative As **the owner**, I reported (2026-08-24, TODO.md L6) that the Containerfile build "is not working". I want `podman build -f Containerfile .` to succeed again — and, more importantly, for the resulting image to serve the **whole app**: all four pages (chat, sources, document viewer, login) with their bundled, minified, local-only assets (No CDN rule, A11), the shared header module evaluated exactly once per page, and a build contract that fails loudly when a future page/script/asset outgrows the Containerfile. - **Given** the 3-stage `Containerfile` (esbuild frontend bundle → uv python deps → slim runtime serving `/app/static`) - **When** `podman build -f Containerfile .` runs - **Then** the build is green and the image serves `/`, `/sources.html`, `/document.html`, `/login.html` with 200 and every referenced asset local and minified — with `header.js` inlined into each page bundle exactly once. ## Bug report (verbatim, TODO.md L6) > Fix Containerfile build not working ## Verified diagnosis (2026-08-24, phase 23 — not a guess) 1. **Root cause of the build failure:** phase 19 switched the page scripts to `import … from "/assets/header.js"` (an absolute URL). esbuild resolves that as the *filesystem* path `/assets/header.js` and the stage-1 bundle dies: `✘ [ERROR] Could not resolve "/assets/header.js"` (reproduced with esbuild **0.25.5**, the exact pinned version, on a copy of `frontend/` — `repro_esbuild_0.25.5.log`). 2. **Secondary gap (image would be broken even if it built):** stage 1 bundled only `app.js` + `sources.js` and copied only `index.html` + `sources.html`. Missing from the image: `document.html` + `login.html` (phases 10/16), `document.js` + `login.js`, and `markdown.js` (classic script loaded by `index.html` + `document.html`). 3. **Latent double-evaluation trap:** all four HTML pages also load `