docs: record Docker 'vite: not found' fix (NODE_ENV root cause) in engineering log

This commit is contained in:
Macky
2026-08-07 19:28:55 +07:00
parent 681561c22a
commit 4827481da3

View File

@@ -0,0 +1,31 @@
# 2026-08-07 — Docker build fix: 'vite: not found' on EasyPanel
## Symptom
EasyPanel `docker build` failed at `RUN cd frontend && npm run build` with:
`sh: 1: vite: not found` (exit 127). Step 7/11 (frontend build).
## Root cause
The Dockerfile set `ENV NODE_ENV=production` *before* `RUN cd frontend && npm install`.
With `NODE_ENV=production`, npm **skips devDependencies** — and `vite` + `@vitejs/plugin-vue`
are devDependencies. So `npm run build` had no `vite` binary → `vite: not found`.
## Fix (commit `bdd7c44`)
- Removed the early `ENV NODE_ENV=production` (must not be set before the frontend build).
- Changed `npm install``npm ci` (deterministic from committed `frontend/package-lock.json`,
falls back to `npm install` if lockfile missing — it is committed, so `npm ci` applies).
- `NODE_ENV` for the Flask runtime is not needed; `FLASK_DEBUG=0` is set at the CMD stage.
## Verification (no local Docker)
- `npm ci` locally: succeeds; `vite` package present under `node_modules/vite` (Node 20/npm 10 in
the image runs esbuild/vite postinstall scripts by default — no `allowScripts` blocking).
- `npm run build`: succeeds (`✓ built`), producing fresh `frontend/dist/`.
- This confirms the Docker npm-build path (devDeps installed → vite present) will now succeed.
## Note on committed frontend source
The router now includes tabbed views (`/my/board``MyBoard.vue`, `/training``Training.vue`,
`/settings``Settings.vue`) and the app's Dashboard is admin-only with `/` → admin, trainees
redirect to `/my/board`. These views are already tracked and pushed; the Docker build ships them.
## Remaining before live model
- Still needs a real `LLM_API_KEY` (+ provider) in `backend/.env` for analyze/persona/chat.
- Validate the Docker build on EasyPanel once re-deployed.