Fix Docker image bloat: exclude local venvs from build context, move transformers.js to devDependencies.
This commit is contained in:
@@ -90,7 +90,7 @@ configuration; flip flags with `docker run -e` / compose `environment:`.
|
||||
| `SIDECAR_PYTHON` | `python3` (with-server-engine image: `/opt/faster-whisper/bin/python3`) | Python interpreter used to spawn `server-py/sidecar.py`. Only override for exotic setups. |
|
||||
| `FASTER_WHISPER_DEVICE` | `auto` | CTranslate2 device for the sidecar (`auto`, `cpu`, `cuda`). In the stock image `auto` resolves to CPU. |
|
||||
| `FASTER_WHISPER_COMPUTE` | `int8` | CTranslate2 compute type (`int8` is the fast, low-memory CPU choice; e.g. `float16` on GPU). |
|
||||
| `FASTER_WHISPER_DOWNLOAD_ROOT` | unset (with-server-engine image: `/app/data/faster-whisper-models`) | Where the sidecar caches downloaded model weights. |
|
||||
| `FASTER_WHISPER_DOWNLOAD_ROOT` | unset (with-server-engine image: `/opt/faster-whisper/models`) | Where the sidecar caches downloaded model weights. The with-server-engine image pre-downloads both server-selectable models (`large-v3-turbo`, `medium.en`) into this path **at build time**, deliberately outside the `/app/data` volume (D-031) — a fresh container never has a cold-download wait, and the models survive volume-less redeploys since they're baked into the image layer. Override to a path under `/app/data` only if you want runtime downloads instead (e.g. a custom image with more server-selectable models than the two baked in). |
|
||||
|
||||
There are no session-secret style variables: sessions are random 256-bit ids
|
||||
stored server-side in SQLite; the cookie is `HttpOnly`, `SameSite=Lax`, and
|
||||
@@ -102,12 +102,31 @@ Mount a volume at **`/app/data`**. It holds:
|
||||
|
||||
- `app.db` — the SQLite database (users + sessions). Without the volume every
|
||||
redeploy logs everyone out and drops accounts.
|
||||
- `faster-whisper-models/` — (server-engine flavor) downloaded Whisper
|
||||
weights, from ~75 MB (`tiny`) to ~1.6 GB (`large-v3-turbo`).
|
||||
|
||||
The server-engine flavor's Whisper weights (`large-v3-turbo`, `medium.en` —
|
||||
the only two models the UI offers on the server engine) are **not** in this
|
||||
volume: they're pre-downloaded into the image itself at
|
||||
`/opt/faster-whisper/models` during `docker build --target with-server-engine`
|
||||
(D-031), so they survive redeploys with no volume needed and there's no
|
||||
first-request download wait. This is also why that image is several GB — see
|
||||
"Image sizes" below.
|
||||
|
||||
Browser-engine model weights never touch the server — they live in each
|
||||
visitor's browser cache.
|
||||
|
||||
### Image sizes
|
||||
|
||||
- **Bun-only** (`runtime`, the default): roughly 400–450 MB — Debian +
|
||||
Bun + the built `dist/` + production `node_modules` (react/react-dom/passport
|
||||
only; `@huggingface/transformers` and its `onnxruntime-node`/`onnxruntime-web`
|
||||
dependencies are a devDependency, D-031 — they're needed to *build* the
|
||||
browser worker bundle, never to *serve* it).
|
||||
- **with-server-engine**: several GB (>7 GB) — the Debian/venv/faster-whisper
|
||||
layer adds a few hundred MB, but the two pre-downloaded models
|
||||
(`large-v3-turbo` + `medium.en`) dominate. Budget disk space and pull time
|
||||
accordingly; this is a deliberate build-time-vs-runtime tradeoff (see above),
|
||||
not bloat to fix.
|
||||
|
||||
### HTTPS / reverse proxy
|
||||
|
||||
Run the container behind a TLS-terminating reverse proxy (Caddy, nginx,
|
||||
|
||||
Reference in New Issue
Block a user