@@ -26,6 +26,9 @@ ARG RUNTIME_IMAGE_TAG="12.8.1-runtime-ubuntu24.04"
2626ARG ARCH=amd64
2727ARG ARCH_ALT=x86_64
2828
29+ ARG SGLANG_VERSION="0.4.9.post1"
30+ ARG SGL_KERNEL_VERSION="0.2.4"
31+
2932FROM ${BASE_IMAGE}:${BASE_IMAGE_TAG} AS nixl_base
3033
3134# Redeclare ARCH and ARCH_ALT so they're available in this stage
@@ -73,7 +76,32 @@ RUN apt-get update -y && \
7376
7477WORKDIR /workspace
7578
76- ### TODO: Bring back UCX EFA setup once we are confident it works with IB devices
79+ ### UCX EFA Setup ###
80+ RUN rm -rf /opt/hpcx/ucx
81+ RUN rm -rf /usr/local/ucx
82+ RUN cd /usr/local/src && \
83+ git clone https://github.com/openucx/ucx.git && \
84+ cd ucx && \
85+ git checkout v1.19.x && \
86+ ./autogen.sh && ./configure \
87+ --prefix=/usr/local/ucx \
88+ --enable-shared \
89+ --disable-static \
90+ --disable-doxygen-doc \
91+ --enable-optimizations \
92+ --enable-cma \
93+ --enable-devel-headers \
94+ --with-cuda=/usr/local/cuda \
95+ --with-verbs \
96+ --with-efa \
97+ --with-dm \
98+ --with-gdrcopy=/usr/local \
99+ --enable-mt && \
100+ make -j && \
101+ make -j install-strip && \
102+ ldconfig
103+
104+ ENV LD_LIBRARY_PATH=/usr/lib:/usr/local/ucx/lib:$LD_LIBRARY_PATH
77105ENV CPATH=/usr/include:$CPATH
78106ENV PATH=/usr/bin:$PATH
79107ENV PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH
@@ -126,21 +154,21 @@ ENV VIRTUAL_ENV=/opt/dynamo/venv
126154ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
127155
128156# Install NIXL Python module
129- # TODO: Move gds_path selection based on arch into NIXL build
130- RUN if [ "$ARCH" = "arm64" ]; then \
131- cd /opt/nixl && uv pip install . --config-settings=setup-args="-Dgds_path=/usr/local/cuda/targets/sbsa-linux"; \
132- else \
133- cd /opt/nixl && uv pip install . ; \
134- fi
157+ RUN cd /opt/nixl && uv build . --out-dir /workspace/wheels/nixl
158+
159+ # Install the wheel
160+ # TODO: Move NIXL wheel install to the wheel_builder stage
161+ RUN uv pip install /workspace/wheels/nixl/*.whl
135162
136163# Install sglang
137- # This commit references a NIXL fix that was releasted after the 0.4.8.post1 release https://github.com/sgl-project/sglang/pull/7330
138- ARG SGLANG_COMMIT="bb9b608c86ebad7d9d01e29fe058bc184dc7285f"
164+ #TODO: Built wheel should become an artifact which can be cached and reused in subsequent builds
165+ ARG SGLANG_VERSION
139166RUN --mount=type=cache,target=/root/.cache/uv \
140167 cd /opt && \
141168 git clone https://github.com/sgl-project/sglang.git && \
142169 cd sglang && \
143- git checkout ${SGLANG_COMMIT} && \
170+ git checkout v${SGLANG_VERSION} && \
171+ # Install in editable mode for development
144172 uv pip install -e "python[all]"
145173
146174# Set env var that allows for forceful shutdown of inflight requests in SGL's TokenizerManager
@@ -379,20 +407,41 @@ ENV DYNAMO_HOME=/workspace
379407ENV VIRTUAL_ENV=/opt/dynamo/venv
380408ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
381409
410+ ### COPY NATS & ETCD ###
411+ # Copy nats and etcd from base image
412+ COPY --from=base /usr/bin/nats-server /usr/bin/nats-server
413+ COPY --from=base /usr/local/bin/etcd/ /usr/local/bin/etcd/
414+ ENV PATH=/usr/local/bin/etcd/:$PATH
415+
416+ # Copy UCX from base image as plugin for NIXL
417+ # Copy NIXL source from base image (required for NIXL plugins)
418+ COPY --from=base /usr/local/ucx /usr/local/ucx
419+ COPY --from=base /usr/local/nixl /usr/local/nixl
420+ ARG ARCH_ALT
421+ ENV NIXL_PLUGIN_DIR=/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu/plugins
422+ ENV LD_LIBRARY_PATH=/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu:/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu/plugins:/usr/local/ucx/lib:$LD_LIBRARY_PATH
423+
382424# Setup the python environment
425+ # libnuma-dev is a required dependency for sglang integration with NIXL
383426COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
384427RUN apt-get update && \
385- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-dev && \
428+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends build-essential python3-dev libnuma -dev && \
386429 rm -rf /var/lib/apt/lists/* && \
387430 uv venv $VIRTUAL_ENV --python 3.12 && \
388431 echo "source $VIRTUAL_ENV/bin/activate" >> ~/.bashrc
389432
433+ # Install SGLang and related packages (sgl-kernel, einops, sentencepiece) since they are not included in the runtime wheel
434+ # https://github.com/sgl-project/sglang/blob/v0.4.9.post1/python/pyproject.toml#L18-51
435+ ARG SGLANG_VERSION
436+ ARG SGL_KERNEL_VERSION
437+ RUN --mount=type=cache,target=/root/.cache/uv \
438+ uv pip install sglang[runtime_common]==${SGLANG_VERSION} einops sgl-kernel==${SGL_KERNEL_VERSION} sentencepiece
439+
390440# Install the wheels and symlink executables to /usr/local/bin so dynamo components can use them
391441# Dynamo components currently do not have the VIRTUAL_ENV in their PATH, so we need to symlink the executables
392442COPY --from=wheel_builder /workspace/dist/*.whl wheelhouse/
393- RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
394- ln -sf $VIRTUAL_ENV/bin/* /usr/local/bin/ && \
395- rm -r wheelhouse
443+ COPY --from=base /workspace/wheels/nixl/*.whl wheelhouse/
444+ RUN uv pip install ai-dynamo nixl --find-links wheelhouse
396445
397446# Tell vllm to use the Dynamo LLM C API for KV Cache Routing
398447ENV VLLM_KV_CAPI_PATH="/opt/dynamo/bindings/lib/libdynamo_llm_capi.so"
@@ -402,8 +451,17 @@ RUN --mount=type=bind,source=./container/launch_message.txt,target=/workspace/la
402451 sed '/^#\s/d' /workspace/launch_message.txt > ~/.launch_screen && \
403452 echo "cat ~/.launch_screen" >> ~/.bashrc
404453
405- # Copy examples
406- COPY ./examples examples/
454+ # Copy benchmarks, examples, and tests for CI
455+ # TODO: Remove this once we have a functional CI image built on top of the runtime image
456+ COPY tests /workspace/tests
457+ COPY benchmarks /workspace/benchmarks
458+ COPY examples /workspace/examples
459+ RUN uv pip install /workspace/benchmarks
407460
408- ENTRYPOINT [ "/usr/bin/bash" ]
461+ # Copy attribution files
462+ COPY ATTRIBUTION* LICENSE /workspace/
463+
464+ ENV PYTHONPATH=/workspace/examples/sglang/utils:$PYTHONPATH
465+
466+ ENTRYPOINT ["/opt/nvidia/nvidia_entrypoint.sh"]
409467CMD []
0 commit comments