Skip to content

Commit 78ac0f5

Browse files
authored
[CI/Build] fix uv caching in Dockerfile (#13611)
1 parent b56155e commit 78ac0f5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Dockerfile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
2828
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
2929
&& python3 --version && python3 -m pip --version
3030
# Install uv for faster pip installs
31-
RUN --mount=type=cache,target=/root/.cache/pip \
31+
RUN --mount=type=cache,target=/root/.cache/uv \
3232
python3 -m pip install uv
3333

3434
# Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
@@ -53,14 +53,14 @@ WORKDIR /workspace
5353
# we need to install torch and torchvision from the nightly builds first,
5454
# pytorch will not appear as a vLLM dependency in all of the following steps
5555
# after this step
56-
RUN --mount=type=cache,target=/root/.cache/pip \
56+
RUN --mount=type=cache,target=/root/.cache/uv \
5757
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
5858
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121"; \
5959
fi
6060

6161
COPY requirements-common.txt requirements-common.txt
6262
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 \
6464
uv pip install --system -r requirements-cuda.txt
6565

6666
# cuda arch list used by torch
@@ -81,7 +81,7 @@ ARG TARGETPLATFORM
8181
# install build dependencies
8282
COPY requirements-build.txt requirements-build.txt
8383

84-
RUN --mount=type=cache,target=/root/.cache/pip \
84+
RUN --mount=type=cache,target=/root/.cache/uv \
8585
uv pip install --system -r requirements-build.txt
8686

8787
COPY . .
@@ -101,7 +101,7 @@ ARG SCCACHE_BUCKET_NAME=vllm-build-sccache
101101
ARG SCCACHE_REGION_NAME=us-west-2
102102
ARG SCCACHE_S3_NO_CREDENTIALS=0
103103
# 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 \
105105
--mount=type=bind,source=.git,target=.git \
106106
if [ "$USE_SCCACHE" = "1" ]; then \
107107
echo "Installing sccache..." \
@@ -121,7 +121,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
121121

122122
ENV CCACHE_DIR=/root/.cache/ccache
123123
RUN --mount=type=cache,target=/root/.cache/ccache \
124-
--mount=type=cache,target=/root/.cache/pip \
124+
--mount=type=cache,target=/root/.cache/uv \
125125
--mount=type=bind,source=.git,target=.git \
126126
if [ "$USE_SCCACHE" != "1" ]; then \
127127
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
@@ -146,7 +146,7 @@ FROM base as dev
146146
COPY requirements-lint.txt requirements-lint.txt
147147
COPY requirements-test.txt requirements-test.txt
148148
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 \
150150
uv pip install --system -r requirements-dev.txt
151151
#################### DEV IMAGE ####################
152152

@@ -178,7 +178,7 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
178178
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
179179
&& python3 --version && python3 -m pip --version
180180
# Install uv for faster pip installs
181-
RUN --mount=type=cache,target=/root/.cache/pip \
181+
RUN --mount=type=cache,target=/root/.cache/uv \
182182
python3 -m pip install uv
183183

184184
# 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/
191191
# we need to install torch and torchvision from the nightly builds first,
192192
# pytorch will not appear as a vLLM dependency in all of the following steps
193193
# after this step
194-
RUN --mount=type=cache,target=/root/.cache/pip \
194+
RUN --mount=type=cache,target=/root/.cache/uv \
195195
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
196196
uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215"; \
197197
fi
198198

199199
# Install vllm wheel first, so that torch etc will be installed.
200200
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 \
202202
uv pip install --system dist/*.whl --verbose
203203

204204
# 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
213213
# $ ls dist
214214
# $ # 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
215215

216-
RUN --mount=type=cache,target=/root/.cache/pip \
216+
RUN --mount=type=cache,target=/root/.cache/uv \
217217
. /etc/environment && \
218218
if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
219219
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
225225
# install build dependencies for JIT compilation.
226226
# TODO: Remove this once FlashInfer AOT wheel is fixed
227227
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 \
229229
uv pip install --system -r requirements-build.txt
230230

231231
#################### vLLM installation IMAGE ####################
@@ -238,15 +238,15 @@ FROM vllm-base AS test
238238
ADD . /vllm-workspace/
239239

240240
# install development dependencies (for testing)
241-
RUN --mount=type=cache,target=/root/.cache/pip \
241+
RUN --mount=type=cache,target=/root/.cache/uv \
242242
uv pip install --system -r requirements-dev.txt
243243

244244
# install development dependencies (for testing)
245-
RUN --mount=type=cache,target=/root/.cache/pip \
245+
RUN --mount=type=cache,target=/root/.cache/uv \
246246
uv pip install --system -e tests/vllm_test_utils
247247

248248
# 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 \
250250
uv pip install --system hf_transfer
251251
ENV HF_HUB_ENABLE_HF_TRANSFER 1
252252

@@ -266,7 +266,7 @@ RUN mv vllm test_docs/
266266
FROM vllm-base AS vllm-openai-base
267267

268268
# 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 \
270270
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
271271
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]; \
272272
else \

0 commit comments

Comments
 (0)