Skip to content

AI-powered virtual executive team — a single coherent executive persona backed by 8 specialist agents (FastAPI + Next.js).

fix(docker): install the api deps with uv sync so each package keeps its locked index

Rufusb0f9edbb9d1a
diff --git a/.github/workflows/release-images.yml b/.github/workflows/release-images.yml
index 2c7ca9d1..d1b3bd51 100644
--- a/.github/workflows/release-images.yml
+++ b/.github/workflows/release-images.yml
@@ -94,10 +94,11 @@ jobs:
type=sha
# Layer cache lives in the registry under a `buildcache` tag, not the
- # Actions cache: the API image's dependency layers (torch and CUDA
- # wheels, two baked embedding models) run to several GB, and the Actions
- # cache is 10 GB per repository, so a `type=gha,mode=max` export would
- # evict itself and the UI's cache on every run.
+ # Actions cache: the API image's dependency layers (torch, two baked
+ # embedding models, a second venv) still run to well over a GB even on
+ # the CPU-only torch build, and the Actions cache is 10 GB per
+ # repository shared across everything, so a `type=gha,mode=max` export
+ # would churn it and evict the UI's cache.
# provenance=false keeps each tag a plain single-platform image; the
# default attestation manifest shows up as an `unknown/unknown` row on
# the package page.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 15437d88..67fe3867 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,12 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **The API image installs the CPU-only build of torch.** torch is only
present because `sentence-transformers` needs it, and the container runs on
CPU hosts, but the default Linux wheel is the CUDA build and pulled in
- fifteen NVIDIA packages plus triton — about 2.6 GB of compressed wheels the
- image never used. torch now resolves from PyTorch's CPU index (2.13.0 →
- 2.14.0+cpu in the lock) and the Dockerfile passes that index to the install.
- Expect the API image to shrink by several GB and cold builds and pulls to
- get much faster. Local `uv sync` gets the same CPU wheel; a GPU deployment
- would need to override the index, which nothing in the repo does today.
+ nineteen packages the image never used — fifteen `nvidia-*` libraries,
+ three `cuda-*` shims and triton, about 2.6 GB of compressed wheels. torch
+ now resolves from PyTorch's CPU index (2.13.0 → 2.14.0+cpu on Linux, plain
+ 2.14.0 on macOS, both from that index) and the Dockerfile installs from the
+ lock with `uv sync` instead of an exported requirements file, so each
+ package comes from the index the lock names. Expect the API image to shrink
+ by several GB and cold builds and pulls to get much faster. `uv sync` gets
+ the same wheels locally; a GPU deployment would need to override the index,
+ and a plain `pip install` of the package (which ignores uv sources) still
+ gets the CUDA build.
## [0.2.0] - 2026-09-22
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 829bf69d..649edb85 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -22,34 +22,30 @@ RUN uvx --from git+https://github.com/SenteLabsAI/extensible-mcp extensible-mcp
|| true
COPY packages/core/pyproject.toml packages/core/uv.lock ./
-# Install exactly what uv.lock pins. `uv pip install -r pyproject.toml` never
-# reads the lockfile — it re-resolves the loose ranges in pyproject.toml
-# against PyPI at build time, so the image drifted from the versions CI
-# tests (#87). `--locked` (NOT `--frozen`, which skips the check) fails the
-# build if uv.lock is stale relative to pyproject.toml — run `uv lock` and
-# commit. The exported `--hash` lines are verified by `uv pip install`; `-q`
-# stops uv echoing the whole export into the build log. Stay on `--system`:
-# the model bakes below and the runtime CMD rely on system site-packages.
-# (The fastembed install further down is a separate, unpinned resolution
-# into the same env; today it moves nothing because the locked versions
-# already satisfy its constraints.)
-# No fallback and no README.md in this layer: a silent fallback previously
-# masked failures while also needing README.md copied here — which busts the
-# cache (full dep install + baked embedding models below) on every README
-# edit (#81). Let a real break fail loudly.
-# torch is pinned to the CPU-only build (`+cpu`, see [tool.uv.sources] in
-# pyproject.toml), which lives on PyTorch's own index, not PyPI. `uv export`
-# does not write index URLs into requirements.txt, so the install has to be
-# told where to look. `unsafe-best-match` is required alongside the extra
-# index: uv's default first-index strategy stops at PyPI as soon as it sees
-# any torch release there and never reaches the `+cpu` wheel. The exported
-# `--hash` lines still verify every download, so the strategy name is scarier
-# than the effect.
-RUN uv export --locked --no-dev --no-emit-project -q -o requirements.txt \
- && uv pip install --system \
- --index-strategy unsafe-best-match \
- --extra-index-url https://download.pytorch.org/whl/cpu \
- -r requirements.txt
+# Install exactly what uv.lock pins, straight from the lock. `uv sync` honours
+# the lock's per-package index (torch comes from PyTorch's CPU-only index,
+# everything else from PyPI — see [tool.uv.sources] in pyproject.toml) and
+# verifies the lock's hashes, so no index or strategy flags are needed here.
+# The previous `uv export` + `uv pip install -r` shape could not do this:
+# the export carries no index URLs, and adding the CPU index at install time
+# made uv fetch every package that mirror also hosts (numpy, sympy, jinja2,
+# requests, ...) from download.pytorch.org instead of PyPI.
+# `--locked` (NOT `--frozen`, which skips the check) fails the build if
+# uv.lock is stale relative to pyproject.toml — run `uv lock` and commit.
+# `--no-install-project`: the source is not in this layer yet (and this keeps
+# README.md out of it — copying it here busts the cache for the full dep
+# install and the baked models below on every README edit, #81); the project
+# itself is registered further down. `--inexact` stops uv removing packages
+# the lock does not know about — `uv` itself was pip-installed above and the
+# fastembed warm-up below adds more. UV_PROJECT_ENVIRONMENT=/usr/local targets
+# the system interpreter's prefix, so the packages land in system
+# site-packages exactly as before: the model bakes below and the runtime CMD
+# rely on that.
+# (The fastembed install further down is a separate, unpinned resolution into
+# the same env; today it moves nothing because the locked versions already
+# satisfy its constraints.)
+RUN UV_PROJECT_ENVIRONMENT=/usr/local \
+ uv sync --locked --no-dev --no-install-project --inexact
# Bake the embedding model the MCP gateway loads at startup
# (sentence-transformers/all-MiniLM-L6-v2). Without this the ~90 MB model is