2.0 KiB
2.0 KiB
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-slimCOPY frontend/dist/ ./frontend/dist/← prebuilt SPA- pip install backend deps
COPY backend/ ./backend/CMD ["python", "run.py"](Flask servesfrontend/dist, which is at the path_register_frontendresolves →/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 onorigin/main.- Backend
_register_frontendpath (Path(__file__).parent.parent.parent/frontend/dist) matches the DockerCOPYtarget/app/frontend/dist. - Local server:
GET /200 (serves the new tabbed SPA), health ok,admin/1234login 200.
Convoying workflow for UI changes
cd frontend && npm run buildgit add frontend/dist/ && git commit- push → EasyPanel redeploys (no npm build step, so no
vitefailure).
Remaining before live model
- Real
LLM_API_KEY(+ provider) inbackend/.envfor analyze/persona/chat. - Re-deploy on EasyPanel to confirm the image builds & runs.