From a60883644be0bcf5219b792b5abbc448e4ea0dcf Mon Sep 17 00:00:00 2001 From: Benoit Tigeot Date: Tue, 28 Apr 2026 19:27:18 +0200 Subject: [PATCH] [Build] Defer flashinfer cubin download to avoid ~2.5 GB (decompressed) layer duplication (#41134) Signed-off-by: Benoit Tigeot --- docker/Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index ca5e35f80c..3d652a5dea 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -585,9 +585,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \ ARG FLASHINFER_VERSION=0.6.8.post1 RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system flashinfer-jit-cache==${FLASHINFER_VERSION} \ - --extra-index-url https://flashinfer.ai/whl/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') \ - && flashinfer show-config \ - && flashinfer download-cubin + --extra-index-url https://flashinfer.ai/whl/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') # ============================================================ # OPENAI API SERVER DEPENDENCIES @@ -669,6 +667,13 @@ RUN --mount=type=bind,from=build,src=/tmp/ep_kernels_workspace/dist,target=/vllm uv pip install --system ep_kernels/dist/*.whl --verbose \ --extra-index-url ${PYTORCH_CUDA_INDEX_BASE_URL}/cu$(echo $CUDA_VERSION | cut -d. -f1,2 | tr -d '.') +# Download FlashInfer precompiled cubins AFTER all pip installs are done. +# This must run after the vLLM wheel and EP kernels installs above, because +# those can reinstall/touch flashinfer packages. Downloading cubins earlier +# (in the flashinfer-jit-cache layer) causes ~2.5 GB of layer duplication +# when a later pip install overwrites flashinfer package files. +RUN flashinfer show-config && flashinfer download-cubin + # CUDA image changed from /usr/local/nvidia to /usr/local/cuda in 12.8 but will # return to /usr/local/nvidia in 13.0 to allow container providers to mount drivers # consistently from the host (see https://github.com/vllm-project/vllm/issues/18859).