From 7fc35df3d4887219b47ef75359511f135445ff02 Mon Sep 17 00:00:00 2001 From: Dmitry Meyer Date: Tue, 20 Oct 2026 14:21:27 +0000 Subject: [PATCH] Preinstall Python 3.11-3.15 into base Docker image Pin uv to 0.13.3. uv embeds the list of Python builds it can install, so previously the patch versions available to runs depended on the latest uv at image build time. With a pinned uv, rebuilding the image yields the same Python builds. Install Python 3.11-3.15 into /opt/uv/python instead of a single default version into root's home. Unlike /root, the shared directory is readable by non-root users. Callers opt in by setting UV_PYTHON_INSTALL_DIR; the job configurator will be updated separately once the image is tested. Drop --default: the python/python3 symlinks it created in ~/.local/bin were never on PATH. --- docker/base/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/base/Dockerfile b/docker/base/Dockerfile index 36da212b75..3657d4e7d3 100644 --- a/docker/base/Dockerfile +++ b/docker/base/Dockerfile @@ -10,6 +10,11 @@ FROM nvidia/cuda:13.0.3-base-ubuntu${UBUNTU_VERSION}.04 AS common # ARGs before FROM must be redeclared to be used after FROM ARG UBUNTU_VERSION +ARG _UV_VERSION="0.13.3" +# Python versions preinstalled into ${_UV_HOME}/python +# To use preinstalled builds, the caller should set UV_PYTHON_INSTALL_DIR +# (--install-dir is only supported by `uv python install`) +ARG _UV_PYTHON_VERSIONS="3.11 3.12 3.13 3.14 3.15" ARG _UV_HOME="/opt/uv" ENV UV_INSTALL_DIR="${_UV_HOME}/bin" @@ -53,8 +58,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \ # Cleanup && rm -rf /var/lib/apt/lists/* -RUN curl -LsSf https://astral.sh/uv/install.sh | INSTALLER_NO_MODIFY_PATH=1 sh \ - && uv python install --preview --default +RUN curl -LsSf https://astral.sh/uv/${_UV_VERSION}/install.sh | UV_NO_MODIFY_PATH=1 sh \ + && uv python install --no-cache --install-dir ${_UV_HOME}/python --no-bin ${_UV_PYTHON_VERSIONS} # ============================================================================ # builder: builds NCCL and nccl-tests from source for the base/devel flavors.