@@ -14,22 +14,19 @@ ARG PYTHON_VERSION=3.12
14
14
ARG TARGETPLATFORM
15
15
ENV DEBIAN_FRONTEND=noninteractive
16
16
17
- # Install Python and other dependencies
17
+ # Install minimal dependencies and uv
18
18
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
19
19
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
20
20
&& apt-get update -y \
21
- && apt-get install -y ccache software-properties-common git curl sudo \
22
- && add-apt-repository ppa:deadsnakes/ppa \
23
- && apt-get update -y \
24
- && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \
25
- && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
26
- && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
27
- && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
28
- && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
29
- && python3 --version && python3 -m pip --version
30
- # Install uv for faster pip installs
31
- RUN --mount=type=cache,target=/root/.cache/uv \
32
- python3 -m pip install uv
21
+ && apt-get install -y ccache git curl wget sudo \
22
+ && curl -LsSf https://astral.sh/uv/install.sh | sh
23
+
24
+ # Add uv to PATH
25
+ ENV PATH="/root/.local/bin:$PATH"
26
+ # Create venv with specified Python and activate by placing at the front of path
27
+ ENV VIRTUAL_ENV="/opt/venv"
28
+ RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
29
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
33
30
34
31
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
35
32
# Reference: https://github.com/astral-sh/uv/pull/1694
@@ -51,21 +48,19 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
51
48
52
49
WORKDIR /workspace
53
50
54
- # install build and runtime dependencies
55
-
56
51
# arm64 (GH200) build follows the practice of "use existing pytorch" build,
57
52
# we need to install torch and torchvision from the nightly builds first,
58
53
# pytorch will not appear as a vLLM dependency in all of the following steps
59
54
# after this step
60
55
RUN --mount=type=cache,target=/root/.cache/uv \
61
56
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
62
- uv pip install --system -- index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121" ; \
57
+ uv pip install --index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121" ; \
63
58
fi
64
59
65
60
COPY requirements-common.txt requirements-common.txt
66
61
COPY requirements-cuda.txt requirements-cuda.txt
67
62
RUN --mount=type=cache,target=/root/.cache/uv \
68
- uv pip install --system - r requirements-cuda.txt
63
+ uv pip install -r requirements-cuda.txt
69
64
70
65
# cuda arch list used by torch
71
66
# can be useful for both `dev` and `test`
@@ -90,12 +85,12 @@ COPY requirements-build.txt requirements-build.txt
90
85
ENV UV_HTTP_TIMEOUT=500
91
86
92
87
RUN --mount=type=cache,target=/root/.cache/uv \
93
- uv pip install --system - r requirements-build.txt
88
+ uv pip install -r requirements-build.txt
94
89
95
90
COPY . .
96
91
ARG GIT_REPO_CHECK=0
97
92
RUN --mount=type=bind,source=.git,target=.git \
98
- if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh ; fi
93
+ if [ "$GIT_REPO_CHECK" != "0" ]; then bash tools/check_repo.sh ; fi
99
94
100
95
# max jobs used by Ninja to build extensions
101
96
ARG max_jobs=2
@@ -132,6 +127,9 @@ RUN --mount=type=cache,target=/root/.cache/ccache \
132
127
--mount=type=cache,target=/root/.cache/uv \
133
128
--mount=type=bind,source=.git,target=.git \
134
129
if [ "$USE_SCCACHE" != "1" ]; then \
130
+ # Clean any existing CMake artifacts
131
+ rm -rf .deps && \
132
+ mkdir -p .deps && \
135
133
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
136
134
fi
137
135
@@ -159,7 +157,7 @@ COPY requirements-lint.txt requirements-lint.txt
159
157
COPY requirements-test.txt requirements-test.txt
160
158
COPY requirements-dev.txt requirements-dev.txt
161
159
RUN --mount=type=cache,target=/root/.cache/uv \
162
- uv pip install --system - r requirements-dev.txt
160
+ uv pip install -r requirements-dev.txt
163
161
# ################### DEV IMAGE ####################
164
162
165
163
# ################### vLLM installation IMAGE ####################
@@ -175,23 +173,20 @@ ARG TARGETPLATFORM
175
173
RUN PYTHON_VERSION_STR=$(echo ${PYTHON_VERSION} | sed 's/\. //g' ) && \
176
174
echo "export PYTHON_VERSION_STR=${PYTHON_VERSION_STR}" >> /etc/environment
177
175
178
- # Install Python and other dependencies
176
+ # Install minimal dependencies and uv
179
177
RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
180
178
&& echo 'tzdata tzdata/Zones/America select Los_Angeles' | debconf-set-selections \
181
179
&& apt-get update -y \
182
- && apt-get install -y ccache software-properties-common git curl wget sudo vim python3-pip \
183
- && apt-get install -y ffmpeg libsm6 libxext6 libgl1 \
184
- && add-apt-repository ppa:deadsnakes/ppa \
185
- && apt-get update -y \
186
- && apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv libibverbs-dev \
187
- && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PYTHON_VERSION} 1 \
188
- && update-alternatives --set python3 /usr/bin/python${PYTHON_VERSION} \
189
- && ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
190
- && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
191
- && python3 --version && python3 -m pip --version
192
- # Install uv for faster pip installs
193
- RUN --mount=type=cache,target=/root/.cache/uv \
194
- python3 -m pip install uv
180
+ && apt-get install -y ccache git curl wget sudo vim \
181
+ && apt-get install -y ffmpeg libsm6 libxext6 libgl1 libibverbs-dev \
182
+ && curl -LsSf https://astral.sh/uv/install.sh | sh
183
+
184
+ # Add uv to PATH
185
+ ENV PATH="/root/.local/bin:$PATH"
186
+ # Create venv with specified Python and activate by placing at the front of path
187
+ ENV VIRTUAL_ENV="/opt/venv"
188
+ RUN uv venv --python ${PYTHON_VERSION} --seed ${VIRTUAL_ENV}
189
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
195
190
196
191
# This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
197
192
# Reference: https://github.com/astral-sh/uv/pull/1694
@@ -209,13 +204,13 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
209
204
# after this step
210
205
RUN --mount=type=cache,target=/root/.cache/uv \
211
206
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
212
- uv pip install --system -- index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215" ; \
207
+ uv pip install --index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215" ; \
213
208
fi
214
209
215
210
# Install vllm wheel first, so that torch etc will be installed.
216
211
RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist \
217
212
--mount=type=cache,target=/root/.cache/uv \
218
- uv pip install --system dist/*.whl --verbose
213
+ uv pip install dist/*.whl --verbose
219
214
220
215
# If we need to build FlashInfer wheel before its release:
221
216
# $ export FLASHINFER_ENABLE_AOT=1
@@ -230,9 +225,8 @@ RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist
230
225
# $ # upload the wheel to a public location, e.g. https://wheels.vllm.ai/flashinfer/524304395bd1d8cd7d07db083859523fcaa246a4/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl
231
226
232
227
RUN --mount=type=cache,target=/root/.cache/uv \
233
- . /etc/environment && \
234
228
if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
235
- uv pip install --system https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post1/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl ; \
229
+ uv pip install https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post1/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl ; \
236
230
fi
237
231
COPY examples examples
238
232
@@ -242,7 +236,7 @@ COPY examples examples
242
236
# TODO: Remove this once FlashInfer AOT wheel is fixed
243
237
COPY requirements-build.txt requirements-build.txt
244
238
RUN --mount=type=cache,target=/root/.cache/uv \
245
- uv pip install --system - r requirements-build.txt
239
+ uv pip install -r requirements-build.txt
246
240
247
241
# ################### vLLM installation IMAGE ####################
248
242
@@ -259,15 +253,15 @@ ENV UV_HTTP_TIMEOUT=500
259
253
260
254
# install development dependencies (for testing)
261
255
RUN --mount=type=cache,target=/root/.cache/uv \
262
- uv pip install --system - r requirements-dev.txt
256
+ uv pip install -r requirements-dev.txt
263
257
264
258
# install development dependencies (for testing)
265
259
RUN --mount=type=cache,target=/root/.cache/uv \
266
- uv pip install --system - e tests/vllm_test_utils
260
+ uv pip install -e tests/vllm_test_utils
267
261
268
262
# enable fast downloads from hf (for testing)
269
263
RUN --mount=type=cache,target=/root/.cache/uv \
270
- uv pip install --system hf_transfer
264
+ uv pip install hf_transfer
271
265
ENV HF_HUB_ENABLE_HF_TRANSFER 1
272
266
273
267
# Copy in the v1 package for testing (it isn't distributed yet)
@@ -292,9 +286,9 @@ ENV UV_HTTP_TIMEOUT=500
292
286
# install additional dependencies for openai api server
293
287
RUN --mount=type=cache,target=/root/.cache/uv \
294
288
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
295
- uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
289
+ uv pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
296
290
else \
297
- uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
291
+ uv pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
298
292
fi
299
293
300
294
ENV VLLM_USAGE_SOURCE production-docker-image
0 commit comments