Skip to content

Commit 3af2c05

Browse files
authored
Merge pull request #48283 from BerriAI/image-content-cleanup-slim-1.106
build(docker): refresh base images and ship only runtime files in component images (1.106.x)
2 parents 4fa8bf1 + 77fc426 commit 3af2c05

7 files changed

Lines changed: 30 additions & 16 deletions

File tree

‎Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# syntax=docker/dockerfile:1.7
22

33
# Base image for building
4-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
4+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
55

66
# Runtime image
7-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
7+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
88
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
99
# Pinned by digest like the other base images; bump explicitly on Node upgrades.
1010
ARG UI_BUILD_IMAGE=node:24.19-alpine3.24@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43

‎backend/Dockerfile‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
2-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
1+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
2+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
33
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
44

55
FROM $UV_IMAGE AS uvbin
@@ -94,7 +94,12 @@ ENV HOME=/home/nonroot \
9494
PYTHONUNBUFFERED=1 \
9595
PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries
9696

97-
COPY --from=builder --chown=nonroot:nonroot /app /app
97+
COPY --from=builder --chown=nonroot:nonroot /app/.venv /app/.venv
98+
COPY --from=builder --chown=nonroot:nonroot /app/litellm /app/litellm
99+
COPY --from=builder --chown=nonroot:nonroot /app/enterprise /app/enterprise
100+
COPY --from=builder --chown=nonroot:nonroot /app/backend /app/backend
101+
COPY --from=builder --chown=nonroot:nonroot /app/docker/component_entrypoint.sh /app/docker/component_entrypoint.sh
102+
COPY --from=builder --chown=nonroot:nonroot /app/schema.prisma /app/schema.prisma
98103
COPY --from=builder /opt/prisma /opt/prisma
99104

100105
RUN find /app/.venv -type f -path "*/tornado/test/*" -delete && \

‎docker/Dockerfile.database‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# syntax=docker/dockerfile:1.7
22

33
# Base image for building
4-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
4+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
55

66
# Runtime image
7-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
7+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
88
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
99
# Pinned by digest like the other base images; bump explicitly on Node upgrades.
1010
ARG UI_BUILD_IMAGE=node:24.19-alpine3.24@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43

‎docker/Dockerfile.non_root‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# syntax=docker/dockerfile:1.7
22

33
# Base images
4-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
5-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
4+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
5+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
66
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
77
# Pinned by digest like the other base images; bump explicitly on Node upgrades.
88
ARG UI_BUILD_IMAGE=node:24.19-alpine3.24@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43

‎gateway/Dockerfile‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
2-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
1+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
2+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
33
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
44
# Checksum from https://www.pgbouncer.org/downloads/ (the Wolfi repo only carries 1.24.x)
55
ARG PGBOUNCER_VERSION=1.26.0
@@ -110,7 +110,12 @@ ENV HOME=/home/nonroot \
110110
PYTHONUNBUFFERED=1 \
111111
PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries
112112

113-
COPY --from=builder --chown=nonroot:nonroot /app /app
113+
COPY --from=builder --chown=nonroot:nonroot /app/.venv /app/.venv
114+
COPY --from=builder --chown=nonroot:nonroot /app/litellm /app/litellm
115+
COPY --from=builder --chown=nonroot:nonroot /app/enterprise /app/enterprise
116+
COPY --from=builder --chown=nonroot:nonroot /app/gateway /app/gateway
117+
COPY --from=builder --chown=nonroot:nonroot /app/docker/component_entrypoint.sh /app/docker/component_entrypoint.sh
118+
COPY --from=builder --chown=nonroot:nonroot /app/schema.prisma /app/schema.prisma
114119
COPY --from=builder /opt/prisma /opt/prisma
115120
COPY --from=pgbouncer-builder /usr/local/bin/pgbouncer /usr/local/bin/pgbouncer
116121

‎migrations/Dockerfile‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
2-
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:81211e15a86ea1d5357f284482af45730c51de45eaf10ad9ce205d6bfc2df323
1+
ARG LITELLM_BUILD_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
2+
ARG LITELLM_RUNTIME_IMAGE=cgr.dev/chainguard/wolfi-base@sha256:360896efb0753a5701c48f860e17130c205eae5a264797aa3e7ea126ee2923a7
33
ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.7@sha256:240fb85ab0f263ef12f492d8476aa3a2e4e1e333f7d67fbdd923d00a506a516a
44

55
FROM $UV_IMAGE AS uvbin
@@ -108,7 +108,9 @@ ENV HOME=/home/nonroot \
108108
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
109109
PRISMA_OFFLINE_MODE=true
110110

111-
COPY --from=builder --chown=nonroot:nonroot /app /app
111+
COPY --from=builder --chown=nonroot:nonroot /app/.venv /app/.venv
112+
COPY --from=builder --chown=nonroot:nonroot /app/litellm /app/litellm
113+
COPY --from=builder --chown=nonroot:nonroot /app/run.py /app/run.py
112114
COPY --from=builder /opt/prisma /opt/prisma
113115

114116
RUN chmod -R a+rX /opt/prisma && \

‎ui/Dockerfile‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# UI container — Next.js static export served by nginx.
44

55
ARG UI_BUILD_IMAGE=node:24.19-alpine3.24@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43
6-
ARG NGINX_VERSION=1.31.5-alpine3.24@sha256:34f40471dea485273c5e2a04dd5e97a682332ceb4a9adecd67de450dcb2fb390
6+
ARG NGINX_VERSION=1.31.8-alpine3.24@sha256:1ef7ca94d7879df82421428ce13bd1eaa412404953859cf7a5b6512c25e67a60
77

88
# ---------- builder ----------
99
FROM ${UI_BUILD_IMAGE} AS builder
@@ -26,6 +26,8 @@ RUN npm run build
2626
# ---------- runtime ----------
2727
FROM nginx:${NGINX_VERSION} AS runtime
2828

29+
RUN apk upgrade --no-cache brotli-libs
30+
2931
# Drop the upstream default :80 server; we own the config.
3032
RUN rm -f /etc/nginx/conf.d/default.conf
3133

0 commit comments

Comments
 (0)