@@ -106,6 +106,94 @@ RUN --mount=type=cache,target=/root/.cache/uv \
106106 --mount=type=bind,source=.git,target=.git \
107107 VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel
108108
109+ #################### WHEEL BUILD IMAGE ####################
110+ FROM base AS build
111+ ARG TARGETPLATFORM
112+
113+ ARG PIP_INDEX_URL UV_INDEX_URL
114+ ARG PIP_EXTRA_INDEX_URL UV_EXTRA_INDEX_URL
115+
116+ # install build dependencies
117+ COPY requirements/build.txt requirements/build.txt
118+
119+ # This timeout (in seconds) is necessary when installing some dependencies via uv since it's likely to time out
120+ # Reference: https://github.com/astral-sh/uv/pull/1694
121+ ENV UV_HTTP_TIMEOUT=500
122+ ENV UV_INDEX_STRATEGY="unsafe-best-match"
123+ # Use copy mode to avoid hardlink failures with Docker cache mounts
124+ ENV UV_LINK_MODE=copy
125+
126+ RUN --mount=type=cache,target=/root/.cache/uv \
127+ uv pip install --python /opt/venv/bin/python3 -r requirements/build.txt
128+
129+ COPY . .
130+ ARG GIT_REPO_CHECK=0
131+ RUN --mount=type=bind,source=.git,target=.git \
132+ if [ "$GIT_REPO_CHECK" != "0" ]; then bash tools/check_repo.sh ; fi
133+
134+ # max jobs used by Ninja to build extensions
135+ ARG max_jobs=2
136+ ENV MAX_JOBS=${max_jobs}
137+
138+ ARG USE_SCCACHE
139+ ARG SCCACHE_DOWNLOAD_URL=https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz
140+ ARG SCCACHE_ENDPOINT
141+ ARG SCCACHE_BUCKET_NAME=vllm-build-sccache
142+ ARG SCCACHE_REGION_NAME=us-west-2
143+ ARG SCCACHE_S3_NO_CREDENTIALS=0
144+
145+ # Flag to control whether to use pre-built vLLM wheels
146+ ARG VLLM_USE_PRECOMPILED=""
147+
148+ # if USE_SCCACHE is set, use sccache to speed up compilation
149+ RUN --mount=type=cache,target=/root/.cache/uv \
150+ --mount=type=bind,source=.git,target=.git \
151+ if [ "$USE_SCCACHE" = "1" ]; then \
152+ echo "Installing sccache..." \
153+ && curl -L -o sccache.tar.gz ${SCCACHE_DOWNLOAD_URL} \
154+ && tar -xzf sccache.tar.gz \
155+ && sudo mv sccache-v0.8.1-x86_64-unknown-linux-musl/sccache /usr/bin/sccache \
156+ && rm -rf sccache.tar.gz sccache-v0.8.1-x86_64-unknown-linux-musl \
157+ && if [ ! -z ${SCCACHE_ENDPOINT} ] ; then export SCCACHE_ENDPOINT=${SCCACHE_ENDPOINT} ; fi \
158+ && export SCCACHE_BUCKET=${SCCACHE_BUCKET_NAME} \
159+ && export SCCACHE_REGION=${SCCACHE_REGION_NAME} \
160+ && export SCCACHE_S3_NO_CREDENTIALS=${SCCACHE_S3_NO_CREDENTIALS} \
161+ && export SCCACHE_IDLE_TIMEOUT=0 \
162+ && export CMAKE_BUILD_TYPE=Release \
163+ && export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" \
164+ && export VLLM_DOCKER_BUILD_CONTEXT=1 \
165+ && sccache --show-stats \
166+ && python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38 \
167+ && sccache --show-stats; \
168+ fi
169+
170+ ARG vllm_target_device="cpu"
171+ ENV VLLM_TARGET_DEVICE=${vllm_target_device}
172+ ENV CCACHE_DIR=/root/.cache/ccache
173+ RUN --mount=type=cache,target=/root/.cache/ccache \
174+ --mount=type=cache,target=/root/.cache/uv \
175+ --mount=type=bind,source=.git,target=.git \
176+ if [ "$USE_SCCACHE" != "1" ]; then \
177+ # Clean any existing CMake artifacts
178+ rm -rf .deps && \
179+ mkdir -p .deps && \
180+ export VLLM_USE_PRECOMPILED="${VLLM_USE_PRECOMPILED}" && \
181+ export VLLM_DOCKER_BUILD_CONTEXT=1 && \
182+ python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
183+ fi
184+
185+ # Check the size of the wheel if RUN_WHEEL_CHECK is true
186+ COPY .buildkite/check-wheel-size.py check-wheel-size.py
187+ # sync the default value with .buildkite/check-wheel-size.py
188+ ARG VLLM_MAX_SIZE_MB=450
189+ ENV VLLM_MAX_SIZE_MB=$VLLM_MAX_SIZE_MB
190+ ARG RUN_WHEEL_CHECK=true
191+ RUN if [ "$RUN_WHEEL_CHECK" = "true" ]; then \
192+ python3 check-wheel-size.py dist; \
193+ else \
194+ echo "Skipping wheel size check."; \
195+ fi
196+
109197######################### TEST DEPS #########################
110198FROM base AS vllm-test-deps
111199
0 commit comments