@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 78ac0f591d
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 15, 22:15 UTC

[CI/Build] fix uv caching in Dockerfile (#13611)

Daniele committed Feb 22, 2025 at 17:25 UTC 78ac0f591d8cde541ee74f2a0a8827d3769e2b86
1 file changed +16 -16
Dockerfile
+16 -16
@@ -28,7 +28,7 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
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/pip \
31 +RUN --mount=type=cache,target=/root/.cache/uv \
32 python3 -m pip install uv
33
34 # Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
@@ -53,14 +53,14 @@ WORKDIR /workspace
53 # we need to install torch and torchvision from the nightly builds first,
54 # pytorch will not appear as a vLLM dependency in all of the following steps
55 # after this step
56 -RUN --mount=type=cache,target=/root/.cache/pip \
56 +RUN --mount=type=cache,target=/root/.cache/uv \
57 if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
58 uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121"; \
59 fi
60
61 COPY requirements-common.txt requirements-common.txt
62 COPY requirements-cuda.txt requirements-cuda.txt
63 -RUN --mount=type=cache,target=/root/.cache/pip \
63 +RUN --mount=type=cache,target=/root/.cache/uv \
64 uv pip install --system -r requirements-cuda.txt
65
66 # cuda arch list used by torch
@@ -81,7 +81,7 @@ ARG TARGETPLATFORM
81 # install build dependencies
82 COPY requirements-build.txt requirements-build.txt
83
84 -RUN --mount=type=cache,target=/root/.cache/pip \
84 +RUN --mount=type=cache,target=/root/.cache/uv \
85 uv pip install --system -r requirements-build.txt
86
87 COPY . .
@@ -101,7 +101,7 @@ ARG SCCACHE_BUCKET_NAME=vllm-build-sccache
101 ARG SCCACHE_REGION_NAME=us-west-2
102 ARG SCCACHE_S3_NO_CREDENTIALS=0
103 # if USE_SCCACHE is set, use sccache to speed up compilation
104 -RUN --mount=type=cache,target=/root/.cache/pip \
104 +RUN --mount=type=cache,target=/root/.cache/uv \
105 --mount=type=bind,source=.git,target=.git \
106 if [ "$USE_SCCACHE" = "1" ]; then \
107 echo "Installing sccache..." \
@@ -121,7 +121,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
121
122 ENV CCACHE_DIR=/root/.cache/ccache
123 RUN --mount=type=cache,target=/root/.cache/ccache \
124 - --mount=type=cache,target=/root/.cache/pip \
124 + --mount=type=cache,target=/root/.cache/uv \
125 --mount=type=bind,source=.git,target=.git \
126 if [ "$USE_SCCACHE" != "1" ]; then \
127 python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
@@ -146,7 +146,7 @@ FROM base as dev
146 COPY requirements-lint.txt requirements-lint.txt
147 COPY requirements-test.txt requirements-test.txt
148 COPY requirements-dev.txt requirements-dev.txt
149 -RUN --mount=type=cache,target=/root/.cache/pip \
149 +RUN --mount=type=cache,target=/root/.cache/uv \
150 uv pip install --system -r requirements-dev.txt
151 #################### DEV IMAGE ####################
152
@@ -178,7 +178,7 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
178 && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
179 && python3 --version && python3 -m pip --version
180 # Install uv for faster pip installs
181 -RUN --mount=type=cache,target=/root/.cache/pip \
181 +RUN --mount=type=cache,target=/root/.cache/uv \
182 python3 -m pip install uv
183
184 # Workaround for https://github.com/openai/triton/issues/2507 and
@@ -191,14 +191,14 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
191 # we need to install torch and torchvision from the nightly builds first,
192 # pytorch will not appear as a vLLM dependency in all of the following steps
193 # after this step
194 -RUN --mount=type=cache,target=/root/.cache/pip \
194 +RUN --mount=type=cache,target=/root/.cache/uv \
195 if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
196 uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215"; \
197 fi
198
199 # Install vllm wheel first, so that torch etc will be installed.
200 RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist \
201 - --mount=type=cache,target=/root/.cache/pip \
201 + --mount=type=cache,target=/root/.cache/uv \
202 uv pip install --system dist/*.whl --verbose
203
204 # If we need to build FlashInfer wheel before its release:
@@ -213,7 +213,7 @@ RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist
213 # $ ls dist
214 # $ # 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
215
216 -RUN --mount=type=cache,target=/root/.cache/pip \
216 +RUN --mount=type=cache,target=/root/.cache/uv \
217 . /etc/environment && \
218 if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
219 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 ; \
@@ -225,7 +225,7 @@ COPY examples examples
225 # install build dependencies for JIT compilation.
226 # TODO: Remove this once FlashInfer AOT wheel is fixed
227 COPY requirements-build.txt requirements-build.txt
228 -RUN --mount=type=cache,target=/root/.cache/pip \
228 +RUN --mount=type=cache,target=/root/.cache/uv \
229 uv pip install --system -r requirements-build.txt
230
231 #################### vLLM installation IMAGE ####################
@@ -238,15 +238,15 @@ FROM vllm-base AS test
238 ADD . /vllm-workspace/
239
240 # install development dependencies (for testing)
241 -RUN --mount=type=cache,target=/root/.cache/pip \
241 +RUN --mount=type=cache,target=/root/.cache/uv \
242 uv pip install --system -r requirements-dev.txt
243
244 # install development dependencies (for testing)
245 -RUN --mount=type=cache,target=/root/.cache/pip \
245 +RUN --mount=type=cache,target=/root/.cache/uv \
246 uv pip install --system -e tests/vllm_test_utils
247
248 # enable fast downloads from hf (for testing)
249 -RUN --mount=type=cache,target=/root/.cache/pip \
249 +RUN --mount=type=cache,target=/root/.cache/uv \
250 uv pip install --system hf_transfer
251 ENV HF_HUB_ENABLE_HF_TRANSFER 1
252
@@ -266,7 +266,7 @@ RUN mv vllm test_docs/
266 FROM vllm-base AS vllm-openai-base
267
268 # install additional dependencies for openai api server
269 -RUN --mount=type=cache,target=/root/.cache/pip \
269 +RUN --mount=type=cache,target=/root/.cache/uv \
270 if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
271 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]; \
272 else \