Consolidate frontend + backend into a single container#493
Open
kcarnold wants to merge 2 commits into
Open
Conversation
9f18e0a to
4623900
Compare
Collapse the two production containers (nginx serving frontend/dist +
proxying /api/, and the Hono backend) into one: the Hono server now serves
the built frontend static files and the /api/* routes.
- backend/src/static.ts: serveStatic with Vite-shaped cache rules. The old
nginx regex (\.[a-f0-9]{8,}\.) matched zero Vite assets, silently
downgrading every hashed bundle from immutable to the 1h rule; the new
rule matches Vite's name-<hash>.ext output. HTML and manifest.xml are
no-store (the only correctness-critical rule). Registered after all
/api/* routes (incl. the dynamic device/debug ones) so the API wins; MPA,
so unmatched GETs 404 (no SPA fallback). No-op in local dev.
- Root Dockerfile + .dockerignore: build context is the repo root; builds
the frontend (incl. google-docs bundle) and backend, serves dist/ as the
static root and the google-docs bundle at /gdocs/.
- docker-compose: drop the frontend service, point backend build at the
root Dockerfile, move the public ports onto backend, set PORT=5000.
- Single persistent volume per env at /app/backend/data (auth.db + logs/
via LOG_DIR). Requires a one-time host data migration (see doc §7).
- .github/workflows/build-addin-image.yml: build & push the combined image
to GHCR (SHA-tagged), mirroring the experiment workflow; runs in parallel
with Jenkins during the deployment migration.
- vite.google-docs.config.ts: publicDir:false so the lib build no longer
re-copies the raw public/manifest.xml over the prod-transformed one.
- Delete frontend/Dockerfile and frontend/nginx.conf.
- Rewrite docs/single-container-consolidation.md for the Vite reality.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4623900 to
0e86c00
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Collapses the two production containers (nginx serving `frontend/dist` + proxying `/api/`, and the Hono backend) into one: the Hono server now serves the built frontend static files and the `/api/*` routes. Deploy/topology change only — app behaviour, the API, and local dev are unchanged.
Spec/record: docs/single-container-consolidation.md.
What's in here
Bugs fixed (both pre-existing, exposed by verification)
Verified against the built image
`/api/ping` 200 · HTML/manifest `no-store` · manifest `application/xml` + prod-transformed · hashed bundle `immutable` · unknown route 404 (MPA) · `/api/does-not-exist` 404 · `/gdocs/...` served · `POST /api/log` writes to the single `data/logs/` volume · backend tests 13/13 · frontend `test:build` green.
Before merge / deploy
🤖 Generated with Claude Code