Refactor dependency versions in Dockerfile

Updated versions of dependencies in Dockerfile for non-root macOS build. Changed hardcoded version numbers to use ARG variables for better maintainability.
This commit is contained in:
superpoussin22 2026-03-15 10:09:29 +01:00 • committed by GitHub
parent 625342e242
commit dba6d8581c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,18 @@
# ---- shared versions ----
ARG PYJWT_VERSION=2.12.0
ARG PRISMA_VERSION=0.11.0
ARG NODEJS_WHEEL_BINARIES_VERSION=24.13.1
ARG SEMANTIC_ROUTER_VERSION=0.1.11
ARG AURELIO_SDK_VERSION=0.0.19
# ---- builder ----
FROM python:3.13-slim AS builder
ARG PROXY_EXTRAS_SOURCE=published
ARG PYJWT_VERSION
ARG PRISMA_VERSION
ARG NODEJS_WHEEL_BINARIES_VERSION
ARG SEMANTIC_ROUTER_VERSION
ARG AURELIO_SDK_VERSION
WORKDIR /app
@ -14,8 +26,10 @@ RUN pip install --no-cache-dir --upgrade pip build
COPY requirements.txt .
RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt \
&& pip wheel --no-cache-dir --wheel-dir=/wheels/ "semantic_router==0.1.11" "aurelio-sdk==0.0.19" \
&& pip wheel --no-cache-dir --wheel-dir=/wheels/ "PyJWT==2.9.0"
&& pip wheel --no-cache-dir --wheel-dir=/wheels/ \
"semantic_router==${SEMANTIC_ROUTER_VERSION}" \
"aurelio-sdk==${AURELIO_SDK_VERSION}" \
"PyJWT==${PYJWT_VERSION}"
COPY . .
ENV LITELLM_NON_ROOT=true
@ -56,7 +70,9 @@ ENV HOME=/app \
PRISMA_BINARY_CACHE_DIR=/app/.cache/prisma-python/binaries \
NPM_CONFIG_CACHE=/app/.cache/npm
RUN pip install --no-cache-dir prisma==0.11.0 nodejs-wheel-binaries==24.13.1 \
RUN pip install --no-cache-dir \
"prisma==${PRISMA_VERSION}" \
"nodejs-wheel-binaries==${NODEJS_WHEEL_BINARIES_VERSION}" \
&& mkdir -p /app/.cache/npm
RUN python3 -c "import prisma.cli.prisma as p; p.ensure_cached()"
@ -74,10 +90,17 @@ s2 = re.sub(pattern, lambda m: strip_binary_targets(m.group(1)), s, flags=re.S)
open(p,"w",encoding="utf-8").write(s2)
PY
RUN python3 -m prisma generate && \
python3 -m prisma --version && \
python3 -m prisma migrate diff --from-empty --to-schema-datamodel ./schema.prisma --script > /dev/null
# ---- runtime ----
FROM python:3.13-slim AS runtime
ARG PROXY_EXTRAS_SOURCE=published
ARG PYJWT_VERSION
ARG SEMANTIC_ROUTER_VERSION
ARG AURELIO_SDK_VERSION
WORKDIR /app
@ -114,19 +137,16 @@ ENV LITELLM_NON_ROOT=true \
RUN pip install --no-index --find-links=/wheels/ -r requirements.txt && \
pip install --no-index --find-links=/wheels/ /wheels/litellm-*-py3-none-any.whl && \
pip install --no-index --find-links=/wheels/ --no-deps semantic_router==0.1.11 && \
pip install --no-index --find-links=/wheels/ aurelio-sdk==0.0.19 && \
pip install --no-index --find-links=/wheels/ --no-deps "semantic_router==${SEMANTIC_ROUTER_VERSION}" && \
pip install --no-index --find-links=/wheels/ "aurelio-sdk==${AURELIO_SDK_VERSION}" && \
if [ "$PROXY_EXTRAS_SOURCE" = "local" ]; then \
if ls /wheels/litellm_proxy_extras-*.whl >/dev/null 2>&1; then \
pip install --no-index --find-links=/wheels/ /wheels/litellm_proxy_extras-*.whl; \
fi; \
fi && \
pip install --no-index --find-links=/wheels/ "PyJWT==2.9.0" && \
pip install --no-index --find-links=/wheels/ "PyJWT==${PYJWT_VERSION}" && \
rm -rf /wheels
RUN pip install --no-cache-dir prisma==0.11.0 nodejs-wheel-binaries==24.13.1 && \
python3 -m prisma generate
RUN python3 - <<'PY'
import site, pathlib, subprocess, tarfile, tempfile, shutil, sys, inspect
@ -159,10 +179,8 @@ def safe_extract(tf: tarfile.TarFile, path: pathlib.Path) -> None:
tf.extractall(path)
def is_node_modules_pkg_dir(d: pathlib.Path) -> bool:
# unscoped: .../node_modules/<pkg>
if d.parent.name == "node_modules":
return True
# scoped: .../node_modules/@scope/<pkg>
if d.parent.parent and d.parent.parent.name == "node_modules" and d.parent.name.startswith("@"):
return True
return False
@ -222,6 +240,10 @@ with tempfile.TemporaryDirectory() as tmpdir:
warn(f"Soft-mode npm patch complete. Total directories replaced: {total_replaced}")
PY
RUN apt-get update && \
apt-get purge -y --auto-remove nodejs npm && \
rm -rf /var/lib/apt/lists/*
RUN sed -i 's/\r$//' /app/docker/entrypoint.sh && \
sed -i 's/\r$//' /app/docker/prod_entrypoint.sh && \
chmod +x /app/docker/entrypoint.sh /app/docker/prod_entrypoint.sh && \