@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 27edd2aeb4
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Build/CI] Revert back to Ubuntu 20.04, install python 3.12 with uv (#26103)

Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Co-authored-by: Simon Mo <simon.mo@hey.com>

Tyler Michael Smith committed Oct 3, 2025 at 01:21 UTC 27edd2aeb410e3126655ca76ef3fd32913ca52fa
2 files changed +21 -31
docker/Dockerfile
+21 -31
@@ -13,8 +13,13 @@ ARG PYTHON_VERSION=3.12
13 # private registries that use a different repository naming conventions.
14 #
15 # Example:
16 -# docker build --build-arg BUILD_BASE_IMAGE=registry.acme.org/mirror/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04
17 -ARG BUILD_BASE_IMAGE=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04
16 +# docker build --build-arg BUILD_BASE_IMAGE=registry.acme.org/mirror/nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
17 +
18 +# Important: We build with an old version of Ubuntu to maintain broad
19 +# compatibility with other Linux OSes. The main reason for this is that the
20 +# glibc version is baked into the distro, and binaries built with one glibc
21 +# version are not backwards compatible with OSes that use an earlier version.
22 +ARG BUILD_BASE_IMAGE=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu20.04
23 # TODO: Restore to base image after FlashInfer AOT wheel fixed
24 ARG FINAL_BASE_IMAGE=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu22.04
25
@@ -75,34 +80,19 @@ ARG TARGETPLATFORM
80 ARG INSTALL_KV_CONNECTORS=false
81 ENV DEBIAN_FRONTEND=noninteractive
82
78 -ARG DEADSNAKES_MIRROR_URL
79 -ARG DEADSNAKES_GPGKEY_URL
83 ARG GET_PIP_URL
84
82 -# Install Python and other dependencies
85 +# Install system dependencies and uv, then create Python virtual environment
86 RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
87 && echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
88 && apt-get update -y \
86 - && apt-get install -y ccache software-properties-common git curl sudo \
87 - && if [ ! -z ${DEADSNAKES_MIRROR_URL} ] ; then \
88 - if [ ! -z "${DEADSNAKES_GPGKEY_URL}" ] ; then \
89 - mkdir -p -m 0755 /etc/apt/keyrings ; \
90 - curl -L ${DEADSNAKES_GPGKEY_URL} | gpg --dearmor > /etc/apt/keyrings/deadsnakes.gpg ; \
91 - sudo chmod 644 /etc/apt/keyrings/deadsnakes.gpg ; \
92 - echo "deb [signed-by=/etc/apt/keyrings/deadsnakes.gpg] ${DEADSNAKES_MIRROR_URL} $(lsb_release -cs) main" > /etc/apt/sources.list.d/deadsnakes.list ; \
93 - fi ; \
94 - else \
95 - for i in 1 2 3; do \
96 - add-apt-repository -y ppa:deadsnakes/ppa && break || \
97 - { echo "Attempt $i failed, retrying in 5s..."; sleep 5; }; \
98 - done ; \
99 - fi \
100 - && apt-get update -y \
101 - && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \
102 - && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
103 - && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
104 - && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
105 - && curl -sS ${GET_PIP_URL} | python${PYTHON_VERSION} \
89 + && apt-get install -y ccache software-properties-common git curl sudo python3-pip \
90 + && curl -LsSf https://astral.sh/uv/install.sh | sh \
91 + && $HOME/.local/bin/uv venv /opt/venv --python ${PYTHON_VERSION} \
92 + && rm -f /usr/bin/python3 /usr/bin/python3-config /usr/bin/pip \
93 + && ln -s /opt/venv/bin/python3 /usr/bin/python3 \
94 + && ln -s /opt/venv/bin/python3-config /usr/bin/python3-config \
95 + && ln -s /opt/venv/bin/pip /usr/bin/pip \
96 && python3 --version && python3 -m pip --version
97
98 ARG PIP_INDEX_URL UV_INDEX_URL
@@ -111,9 +101,9 @@ ARG PYTORCH_CUDA_INDEX_BASE_URL
101 ARG PYTORCH_CUDA_NIGHTLY_INDEX_BASE_URL
102 ARG PIP_KEYRING_PROVIDER UV_KEYRING_PROVIDER
103
114 -# Install uv for faster pip installs
115 -RUN --mount=type=cache,target=/root/.cache/uv \
116 - python3 -m pip install uv
104 +# Activate virtual environment and add uv to PATH
105 +ENV PATH="/opt/venv/bin:/root/.local/bin:$PATH"
106 +ENV VIRTUAL_ENV="/opt/venv"
107
108 # This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
109 # Reference: https://github.com/astral-sh/uv/pull/1694
@@ -142,7 +132,7 @@ WORKDIR /workspace
132 COPY requirements/common.txt requirements/common.txt
133 COPY requirements/cuda.txt requirements/cuda.txt
134 RUN --mount=type=cache,target=/root/.cache/uv \
145 - uv pip install --system -r requirements/cuda.txt \
135 + uv pip install --python /opt/venv/bin/python3 -r requirements/cuda.txt \
136 --extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
137
138 # cuda arch list used by torch
@@ -172,7 +162,7 @@ ENV UV_INDEX_STRATEGY="unsafe-best-match"
162 ENV UV_LINK_MODE=copy
163
164 RUN --mount=type=cache,target=/root/.cache/uv \
175 - uv pip install --system -r requirements/build.txt \
165 + uv pip install --python /opt/venv/bin/python3 -r requirements/build.txt \
166 --extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
167
168 COPY . .
@@ -269,7 +259,7 @@ COPY requirements/lint.txt requirements/lint.txt
259 COPY requirements/test.txt requirements/test.txt
260 COPY requirements/dev.txt requirements/dev.txt
261 RUN --mount=type=cache,target=/root/.cache/uv \
272 - uv pip install --system -r requirements/dev.txt \
262 + uv pip install --python /opt/venv/bin/python3 -r requirements/dev.txt \
263 --extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.')
264 #################### DEV IMAGE ####################
265
docs/assets/contributing/dockerfile-stages-dependency.png
Binary files a/docs/assets/contributing/dockerfile-stages-dependency.png and b/docs/assets/contributing/dockerfile-stages-dependency.png differ