Skip to content

Commit 47fe12b

Browse files
committed
Fix docker build cache
Signed-off-by: Shiming Zhang <[email protected]>
1 parent 4429d93 commit 47fe12b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ share/python-wheels/
3131
.installed.cfg
3232
*.egg
3333
MANIFEST
34+
docker/

docker/Dockerfile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ WORKDIR /workspace
267267

268268
COPY --from=csrc-build /workspace/dist /precompiled-wheels
269269

270-
COPY . .
270+
# Exclude .git to avoid cache misses
271+
COPY --exclude=.git . .
271272

272273
ARG GIT_REPO_CHECK=0
273274
RUN --mount=type=bind,source=.git,target=.git \
@@ -279,12 +280,22 @@ ENV VLLM_TARGET_DEVICE=${vllm_target_device}
279280
# Skip adding +precompiled suffix to version (preserves git-derived version)
280281
ENV VLLM_SKIP_PRECOMPILED_VERSION_SUFFIX=1
281282

283+
ARG USE_GIT_VERSION=0
284+
RUN --mount=type=cache,target=/root/.cache/uv \
285+
if [ "$USE_GIT_VERSION" = "0" ]; then \
286+
if [ "${vllm_target_device}" = "cuda" ]; then \
287+
export VLLM_PRECOMPILED_WHEEL_LOCATION=$(ls /precompiled-wheels/*.whl); \
288+
fi && \
289+
SETUPTOOLS_SCM_PRETEND_VERSION="0.0.0+src.build" python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
290+
fi
282291
RUN --mount=type=cache,target=/root/.cache/uv \
283292
--mount=type=bind,source=.git,target=.git \
284-
if [ "${vllm_target_device}" = "cuda" ]; then \
285-
export VLLM_PRECOMPILED_WHEEL_LOCATION=$(ls /precompiled-wheels/*.whl); \
286-
fi && \
287-
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38
293+
if [ "$USE_GIT_VERSION" != "0" ]; then \
294+
if [ "${vllm_target_device}" = "cuda" ]; then \
295+
export VLLM_PRECOMPILED_WHEEL_LOCATION=$(ls /precompiled-wheels/*.whl); \
296+
fi && \
297+
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
298+
fi
288299

289300
# Install DeepGEMM from source
290301
ARG DEEPGEMM_GIT_REF

0 commit comments

Comments
 (0)