Skip to content

build(docker): refresh base images and ship only runtime files in component images (1.104.x) - #48280

Merged
yuneng-berri merged 2 commits into
stable/1.104.xfrom
image-content-cleanup-slim-1.104
Oct 25, 2026
Merged

yuneng-berri merged 2 commits into
stable/1.104.xfrom
image-content-cleanup-slim-1.104

Conversation

@yuneng-berri

@yuneng-berri yuneng-berri commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #48279 to stable/1.104.x

Every image moves to newer wolfi-base and nginx base images, which clears the Critical brotli finding image scanners report today and drops the emSign ECC Root CA - G3 root from the UI image's CA bundle. The gateway, backend and migrations images now copy only the files they run instead of the whole source tree, so scanners stop reporting packages from repo lockfiles that were never installed

Details

TLDR

Problem this solves:

  • Image scans flag a Critical brotli 1.2.0 in every Wolfi image and the UI
  • The UI image's CA bundle still includes emSign ECC Root CA - G3
  • Component images ship repo lockfiles, so scanners report packages that aren't installed

How it solves it:

  • Bump wolfi-base to sha256:360896ef in all six Wolfi Dockerfiles
  • Bump nginx to 1.31.8-alpine3.24 and upgrade brotli-libs in the UI image
  • Gateway, backend and migrations copy only their runtime files into /app

User Flow

Before: a platform team scanning the gateway and UI images gets findings for things the images never use

  1. They pull the gateway and UI images and run their image scanner on both
  2. The report lists a Critical brotli 1.2.0, emSign ECC Root CA - G3 in the UI's CA bundle, and packages read from /app/uv.lock and /app/terraform/provider/go.sum
  3. They open a ticket asking which of those findings are real

After: the same scan only reports what the images actually run

  1. They pull the gateway and UI images and run their image scanner on both
  2. The report has no brotli Critical, no emSign ECC Root CA - G3 in any CA bundle the images use, and no packages from repo lockfiles
  3. Nothing to chase down

Linear ticket

Resolves LIT-10128

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Images are built for linux/arm64 with docker build -f <Dockerfile> . and scanned with grype 0.114.0. The fingerprint check is a local script that matches the SHA-256 fingerprint (86:A1:EC:BA:...) and public key of emSign ECC Root CA - G3 against every file in the image, so it also finds copies compiled into binaries. Hits under /opt/prisma are left out, see Caveats. The chat call uses this gateway config with a real Gemini key

model_list:
  - model_name: gemini-3.8-flash
    litellm_params:
      model: gemini/gemini-3.8-flash
      api_key: os.environ/GEMINI_API_KEY

Before (4a8940a)

The published v1.104.6 images, whose Dockerfiles are identical to stable/1.104.x at 4a8940a. The gateway runs against the database the After run migrated

UI image

  1. Fingerprint check of every file in ghcr.io/berriai/litellm-ui:v1.104.6 for emSign ECC Root CA - G3
    emSign ECC Root CA - G3 :: /etc/ssl/certs/ca-certificates.crt
    emSign ECC Root CA - G3 :: /usr/share/ca-certificates/mozilla/emSign_ECC_Root_CA_-_G3.crt
    
  2. grype ghcr.io/berriai/litellm-ui:v1.104.6, Critical findings
    brotli-libs 1.2.0-r1 CVE-2026-111497
    

Gateway image

  1. Lockfiles in ghcr.io/berriai/litellm-gateway:v1.104.6 outside the virtualenv
    /app/litellm-rust/Cargo.lock
    /app/package-lock.json
    /app/terraform/provider/go.sum
    /app/ui/litellm-dashboard/package-lock.json
    /app/uv.lock
    /app/vscode-extension/package-lock.json
    /opt/prisma/binaries/package-lock.json
    
  2. grype ghcr.io/berriai/litellm-gateway:v1.104.6, Critical findings
    libbrotlicommon1 1.2.0-r6 CVE-2026-111497
    libbrotlidec1 1.2.0-r6 CVE-2026-111497
    libbrotlienc1 1.2.0-r6 CVE-2026-111497
    

Real chat call through the gateway image

  1. The database is the one the After run's migrations image set up, since this PR doesn't change the schema
  2. docker run -d -p 15604:4000 -e CONFIG_FILE_PATH=/app/config/config.yaml -e GEMINI_API_KEY -v ./config:/app/config:ro ghcr.io/berriai/litellm-gateway:v1.104.6, then curl -s localhost:15604/health/readiness
    {'status': 'healthy', 'db': 'connected', 'litellm_version': None}
    
  3. curl -s localhost:15604/v1/chat/completions -H 'Authorization: Bearer $KEY' -d '{"model":"gemini-3.8-flash","messages":[{"role":"user","content":"Reply with exactly: image ok"}]}'
    {"model": "gemini-3.8-flash", "content": "image ok", "usage": {"prompt_tokens": 7, "completion_tokens": 94}}
    

After (99aa8f8)

q1104-*:pr are local builds of this tip

UI image

  1. Fingerprint check of every file in q1104-ui:pr for emSign ECC Root CA - G3
    (none found)
    
  2. grype q1104-ui:pr, Critical findings
    (none)
    

Gateway image

  1. Lockfiles in q1104-gateway:pr outside the virtualenv
    /opt/prisma/binaries/package-lock.json
    
  2. grype q1104-gateway:pr, Critical findings
    (none)
    

Real chat call through the gateway image

  1. docker run --rm --network proof-net -e DATABASE_URL=... q1104-migrations:pr
    Migration job completed successfully, 83 tables
    
  2. docker run -d -p 14101:4000 -e CONFIG_FILE_PATH=/app/config/config.yaml -e GEMINI_API_KEY -v ./config:/app/config:ro q1104-gateway:pr, then curl -s localhost:14101/health/readiness
    {'status': 'healthy', 'db': 'connected', 'litellm_version': None}
    
  3. curl -s localhost:14101/v1/chat/completions -H 'Authorization: Bearer $KEY' -d '{"model":"gemini-3.8-flash","messages":[{"role":"user","content":"Reply with exactly: image ok"}]}'
    {"model": "gemini-3.8-flash", "content": "image ok", "usage": {"prompt_tokens": 7, "completion_tokens": 72}}
    

Type

🐛 Bug Fix
🚄 Infrastructure

Caveats (if any)

Medium

  • Anything reading other repo files from /app in gateway, backend or migrations now misses them
    • Checked on this tip: all seven images build and pass their image tests
    • 9 of 9 gateway and backend setups boot healthy, including pgbouncer, ddtrace, two workers, a config callback and both sidecars

Low

  • The Prisma engines under /opt/prisma still embed a built-in root list that includes emSign ECC Root CA - G3
    • Prisma only uses that list for MongoDB, which litellm doesn't use, so Postgres TLS reads the system bundle
  • emSign Root CA - G1, C1 and C3 are still in certifi, grpc, the Rust bridge and the system bundle
    • They aren't part of the G3 hierarchy, and certifi 2026.10.19 kept them on purpose
  • grype still reports a fixable High on filelock, which this PR doesn't touch

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Bump the pinned wolfi-base digest in every Wolfi Dockerfile to 360896ef, which
ships brotli 1.2.1-r1 and ca-certificates-bundle 20260909-r3. The previous
digest already carried libbrotli 1.2.0-r6 as an OpenSSL dependency, and
`apk add --no-cache` never upgrades a package the base already has

Move the UI image to nginx 1.31.8-alpine3.24, whose CA bundle is the 20261020
Mozilla set, and upgrade brotli-libs in its runtime stage since no nginx
digest ships 1.2.1 yet
…migrations images

The component runtime stages copied the builder's whole /app, which is the
entire repository plus build output: six lockfiles, helm, terraform, docs,
.env.example and the Rust build tree. Measured at runtime with an audit hook
on a booted container, the gateway reads only gateway/, litellm/ and
enterprise/ from /app, the backend only backend/, litellm/ and enterprise/,
and the migrations job only litellm/ and run.py. The pyproject.toml read is
prisma-python's optional [tool.prisma] lookup, which ours does not define

Copy just those, plus .venv, the entrypoint script and schema.prisma for the
gateway and backend. PYTHONPATH=/app and the in-Dockerfile asserts are
unchanged
@yuneng-berri
yuneng-berri requested a review from a team October 25, 2026 02:05
@yuneng-berri
yuneng-berri merged commit 375b48f into stable/1.104.x Oct 25, 2026
7 checks passed
@yuneng-berri
yuneng-berri deleted the image-content-cleanup-slim-1.104 branch October 25, 2026 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants