41 lines
2.0 KiB
Markdown
41 lines
2.0 KiB
Markdown
# 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.
|