3
3
4
4
ARG BASE_IMAGE="nvcr.io/nvidia/cuda-dl-base"
5
5
ARG BASE_IMAGE_TAG="25.01-cuda12.8-devel-ubuntu24.04"
6
-
6
+ ARG RELEASE_BUILD
7
7
ARG RUNTIME_IMAGE="nvcr.io/nvidia/cuda"
8
8
ARG RUNTIME_IMAGE_TAG="12.8.1-runtime-ubuntu24.04"
9
-
9
+ ARG MANYLINUX_IMAGE="quay.io/pypa/manylinux_2_28_x86_64"
10
10
ARG GENAI_PERF_TAG="25d0188713adc47868d6b3f22426375237a90529"
11
11
12
12
FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS nixl_base
@@ -280,24 +280,6 @@ RUN cargo build --release --locked --features mistralrs,sglang,vllm,python && \
280
280
281
281
COPY deploy/dynamo/sdk /workspace/deploy/dynamo/sdk
282
282
COPY deploy/dynamo/api-store /workspace/deploy/dynamo/api-store
283
- # Build dynamo wheel
284
- RUN source /opt/dynamo/venv/bin/activate && \
285
- cd /workspace/lib/bindings/python && \
286
- uv build --wheel --out-dir /workspace/dist && \
287
- uv pip install /workspace/dist/ai_dynamo_runtime*cp312*.whl && \
288
- cd /workspace && \
289
- uv build --wheel --out-dir /workspace/dist && \
290
- uv pip install /workspace/dist/ai_dynamo*any.whl && \
291
- cd /workspace/deploy/dynamo/api-store && \
292
- uv build --wheel --out-dir /workspace/dist && \
293
- uv pip install /workspace/dist/ai_dynamo_store*any.whl
294
-
295
- # Package the bindings
296
- RUN mkdir -p /opt/dynamo/bindings/wheels && \
297
- mkdir /opt/dynamo/bindings/lib && \
298
- cp dist/ai_dynamo*cp312*.whl /opt/dynamo/bindings/wheels/. && \
299
- cp target/release/libdynamo_llm_capi.so /opt/dynamo/bindings/lib/. && \
300
- cp -r lib/bindings/c/include /opt/dynamo/bindings/.
301
283
302
284
# Tell vllm to use the Dynamo LLM C API for KV Cache Routing
303
285
ENV VLLM_KV_CAPI_PATH="/opt/dynamo/bindings/lib/libdynamo_llm_capi.so"
@@ -309,12 +291,74 @@ RUN --mount=type=bind,source=./container/launch_message.txt,target=/workspace/la
309
291
310
292
CMD []
311
293
294
+ ###################################
295
+ ####### WHEEL BUILD STAGE #########
296
+ ###################################
297
+
298
+ # Build the wheel in the manylinux environment
299
+ FROM ${MANYLINUX_IMAGE} AS wheel_builder
300
+ ARG CARGO_BUILD_JOBS
301
+ # Set CARGO_BUILD_JOBS to 16 if not provided
302
+ # This is to prevent cargo from building $(nproc) jobs in parallel,
303
+ # which might exceed the number of opened files limit.
304
+ ENV CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-16}
305
+ # Use build arg RELEASE_BUILD = true to generate wheels for Python 3.10, 3.11 and 3.12.
306
+ ARG RELEASE_BUILD
307
+ WORKDIR /workspace
308
+
309
+ RUN yum install -y protobuf-compiler \
310
+ && yum clean all \
311
+ && rm -rf /var/cache/yum
312
+
313
+ ENV RUSTUP_HOME=/usr/local/rustup \
314
+ CARGO_HOME=/usr/local/cargo \
315
+ PATH=/usr/local/cargo/bin:$PATH \
316
+ CARGO_TARGET_DIR=/workspace/target
317
+
318
+ COPY --from=build /workspace /workspace
319
+ COPY --from=build $RUSTUP_HOME $RUSTUP_HOME
320
+ COPY --from=build $CARGO_HOME $CARGO_HOME
321
+
322
+ # Copy uv from build and build wheel in virtualenv
323
+ RUN mkdir /opt/dynamo && \
324
+ uv venv /opt/dynamo/venv --python 3.12
325
+
326
+ # Activate virtual environment
327
+ ENV VIRTUAL_ENV=/opt/dynamo/venv
328
+ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
329
+ ENV PATH="$PATH:/usr/local/bin"
330
+
331
+ # Build dynamo wheel
332
+ RUN source /opt/dynamo/venv/bin/activate && \
333
+ cd /workspace/lib/bindings/python && \
334
+ uv build --wheel --out-dir /workspace/dist --python 3.12 && \
335
+ if [ "$RELEASE_BUILD" = "true" ]; then \
336
+ uv build --wheel --out-dir /workspace/dist --python 3.11 && \
337
+ uv build --wheel --out-dir /workspace/dist --python 3.10; \
338
+ fi && \
339
+ cd /workspace && \
340
+ uv build --wheel --out-dir /workspace/dist && \
341
+ cd /workspace/deploy/dynamo/api-store && \
342
+ uv build --wheel --out-dir /workspace/dist
343
+
312
344
#######################################
313
345
########## CI Minimum Image ###########
314
346
#######################################
315
347
FROM build AS ci_minimum
316
348
317
349
COPY . /workspace
350
+ COPY --from=wheel_builder /workspace/dist/ /workspace/dist/
351
+
352
+ # Package the bindings
353
+ RUN mkdir -p /opt/dynamo/bindings/wheels && \
354
+ mkdir /opt/dynamo/bindings/lib && \
355
+ cp dist/ai_dynamo*cp312*.whl /opt/dynamo/bindings/wheels/. && \
356
+ cp target/release/libdynamo_llm_capi.so /opt/dynamo/bindings/lib/. && \
357
+ cp -r lib/bindings/c/include /opt/dynamo/bindings/.
358
+
359
+ RUN uv pip install /workspace/dist/ai_dynamo_runtime*cp312*.whl && \
360
+ uv pip install /workspace/dist/ai_dynamo*any.whl && \
361
+ uv pip install /workspace/dist/ai_dynamo_store*any.whl
318
362
319
363
##########################################
320
364
########## Perf Analyzer Image ###########
@@ -338,7 +382,7 @@ RUN mkdir bin && \
338
382
########################################
339
383
########## Development Image ###########
340
384
########################################
341
- FROM build AS dev
385
+ FROM ci_minimum AS dev
342
386
343
387
ARG GENAI_PERF_TAG
344
388
@@ -380,8 +424,8 @@ RUN apt-get update && \
380
424
echo "source $VIRTUAL_ENV/bin/activate" >> ~/.bashrc
381
425
382
426
# Install the wheels
383
- COPY --from=build /workspace/dist/*.whl wheelhouse/
384
- RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
427
+ COPY --from=wheel_builder /workspace/dist/*.whl wheelhouse/
428
+ RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
385
429
rm -r wheelhouse
386
430
387
431
# Tell vllm to use the Dynamo LLM C API for KV Cache Routing
0 commit comments