fix(docker): restore uv in the runtime container image

Merged
FA
4mo ago
+5-1

Problem

PR #9868 split the Dockerfile into a builder stage (compiler toolchain + uv) and a slim backend runtime stage that copies only the prebuilt /.venv. That dropped uv from the shipped image, breaking downstream images built FROM the Infrahub image that install extra Python packages into the environment.

Fix

Copy just the uv/uvx standalone binaries from the base toolchain stage into the runtime image's /usr/local/bin (already on PATH). This keeps the size win from #9868 โ€” the ~290 MB compiler stack (build-essential, pkg-config) stays out of the runtime image โ€” while restoring the ability to extend the environment.

Verification

The change is isolated to the backend stage, so I verified it by mirroring that stage (python:3.14.3-slim + ENV PATH="/.venv/bin:${PATH}" + the exact COPY):

  • uv and uvx resolve on PATH in a fresh shell (/usr/local/bin/{uv,uvx})
  • uv venv + uv pip install into a new venv succeeds โ€” i.e. the downstream "build a custom image on top of Infrahub" flow works again

๐Ÿค– Generated with Claude Code


Summary by cubic

Restore uv and uvx in the runtime Docker image so downstream images can install Python packages into the shipped /.venv again. The image stays slim by excluding the compiler toolchain.

  • Bug Fixes
    • Copy uv and uvx from the base stage into /usr/local/bin in the runtime stage.
    • Verified uv is on PATH and downstream installs into /.venv succeed.