Files

53 lines
2.1 KiB
Markdown

# sap-drawio — Build Files
Image source repo (Dockerfile lives there, NOT in this store folder):
`~/projects/sap-architecture-diagrams` (git remote `git.alexzaw.dev/alexz/sap-architecture-diagrams`).
## What the image is
A single multi-stage image, `git.alexzaw.dev/alexz/sap-drawio:latest`:
1. **Builder stage** (`node:20-bookworm-slim`) — builds the React (CRA + CRACO,
Yarn Classic 1.22.22) frontend with `REACT_APP_BACKEND_URL=""` so all API
calls are same-origin (`/api`), working from any host/domain.
2. **Runtime stage** (`python:3.12-slim`) — installs `backend/requirements.txt`,
copies `backend/` to `/app/backend` and the built UI to `/app/frontend/build`
(FastAPI/uvicorn serves both from one process on port 8011), bakes the
12 MB SQLite catalog seed to `/seed/app.db`, and runs as root (homelab —
avoids the non-root volume-permission trap).
## How to build
```bash
cd /etc/runtipi/repos/runtipi/apps/sap-drawio/build
./build.sh
```
Builds and pushes `git.alexzaw.dev/alexz/sap-drawio:latest`. Override
`IMAGE_NAME` / `IMAGE_TAG` / `SRC` env vars if needed. To build without
pushing, run the `docker build` line directly from `$SRC`.
## Seed-on-first-run behavior
`docker/entrypoint.sh` (in the source repo) copies `/seed/app.db`
`/data/app.db` only if `/data/app.db` is absent, then execs uvicorn. This
means:
- First install: the persistent volume (`${APP_DATA_DIR}/data` on the host)
gets the baked catalog (icons/services) as its starting point.
- Every subsequent `app update`/restart: the existing `/data/app.db` (with any
saved conversions, added logos, etc.) is left untouched — the image rebuild
never overwrites live data.
## LLM dependency
Calls an Ollama-compatible host at `OLLAMA_URL` (form field, defaults to
`http://192.168.0.32:11434`, this homeserver's local `ollama-nvidia` app).
Models (`VISION_MODEL`, `VALIDATOR_MODEL`) are also form fields so they can be
changed without a rebuild. `qwen3-vl:8b` / `gemma4:31b` must exist on the
Ollama host for the defaults to work.
## Architecture note
**amd64 only.** No multi-arch build — matches the host architecture; not
needed for this homelab deployment.