diff --git a/docs/engineering-log.md b/docs/engineering-log.md index cbf6eb2..7a2963f 100644 --- a/docs/engineering-log.md +++ b/docs/engineering-log.md @@ -35,3 +35,4 @@ Informed by MiroFish (CrowdSight engine) + the hermes-brain-and-tools CrowdSight - `2026-08-07-build-out.md` — M0–M7 build-out, decisions, verification, current state. - `2026-08-07-security-ux.md` — security hardening (path traversal, IDOR, XSS) + UX/UI polish. - `2026-08-07-auth-gitea.md` — username login + first-time admin setup + Gitea push. +- `2026-08-07-docker-final.md` — Docker build fix: ship prebuilt frontend/dist, no npm in image (resolves repeated `vite: not found`). diff --git a/docs/engineering-log/2026-08-07-docker-final.md b/docs/engineering-log/2026-08-07-docker-final.md new file mode 100644 index 0000000..f7e37fb --- /dev/null +++ b/docs/engineering-log/2026-08-07-docker-final.md @@ -0,0 +1,40 @@ +# 2026-08-07 — Docker build: final fix = ship prebuilt dist, drop npm from image + +## Correction to earlier entry +The first "fix" (remove `NODE_ENV=production`, use `npm ci`) was **never actually persisted** — +the committed Dockerfile still had `ENV NODE_ENV=production` + `npm install`, and EasyPanel still +failed with `vite: not found` at the npm build step. (The earlier Dockerfile-change commit turned +out not to be on the remote.) + +## Decision: stop running npm inside the Docker image +Building the Vue app inside Docker depends on npm + esbuild postinstall, which is the exact source +of the repeated `vite: not found` failures. To make deployments deterministic, the SPA is now +**built locally** and its `frontend/dist/` is **committed to the repo** (force-added; +`.gitignore` updated with `!frontend/dist/`). + +## New Dockerfile (apply: commit `c19b23d`) +Single-stage, no node/npm/vite anywhere in commands: +- `FROM python:3.11-slim` +- `COPY frontend/dist/ ./frontend/dist/` ← prebuilt SPA +- pip install backend deps +- `COPY backend/ ./backend/` +- `CMD ["python", "run.py"]` (Flask serves `frontend/dist`, which is at the path + `_register_frontend` resolves → `/app/frontend/dist`) + +`.dockerignore` no longer excludes `frontend/dist/`. + +## Verification (no local Docker) +- Dockerfile has zero node/npm/vite in any RUN/COPY/CMD (only comments mention them). +- `frontend/dist/` (28 files) tracked and pushed on `origin/main`. +- Backend `_register_frontend` path (`Path(__file__).parent.parent.parent/frontend/dist`) + matches the Docker `COPY` target `/app/frontend/dist`. +- Local server: `GET /` 200 (serves the new tabbed SPA), health ok, `admin`/`1234` login 200. + +## Convoying workflow for UI changes +1. `cd frontend && npm run build` +2. `git add frontend/dist/ && git commit` +3. push → EasyPanel redeploys (no npm build step, so no `vite` failure). + +## Remaining before live model +- Real `LLM_API_KEY` (+ provider) in `backend/.env` for analyze/persona/chat. +- Re-deploy on EasyPanel to confirm the image builds & runs.