Skip to content

Commit 93ca9df

Browse files
authored
build: fixes to enable vLLM slim runtime image (#1058)
1 parent 8d32448 commit 93ca9df

File tree

1 file changed

+38
-6
lines changed

1 file changed

+38
-6
lines changed

container/Dockerfile.vllm

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,16 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
154154
# Install NIXL Python module
155155
# TODO: Move gds_path selection based on arch into NIXL build
156156
RUN if [ "$ARCH" = "arm64" ]; then \
157-
cd /opt/nixl && uv pip install . --config-settings=setup-args="-Dgds_path=/usr/local/cuda/targets/sbsa-linux"; \
157+
cd /opt/nixl && uv build . --out-dir /workspace/wheels/nixl \
158+
--config-settings=setup-args="-Dgds_path=/usr/local/cuda/targets/sbsa-linux"; \
158159
else \
159-
cd /opt/nixl && uv pip install . ; \
160+
cd /opt/nixl && uv build . --out-dir /workspace/wheels/nixl; \
160161
fi
161162

163+
# Install the wheel
164+
# TODO: Move NIXL wheel install to the wheel_builder stage
165+
RUN uv pip install /workspace/wheels/nixl/*.whl
166+
162167
# Install patched vllm - keep this early in Dockerfile to avoid
163168
# rebuilds from unrelated source code changes
164169
ARG VLLM_REF="0.8.4"
@@ -465,18 +470,45 @@ ENV DYNAMO_HOME=/workspace
465470
ENV VIRTUAL_ENV=/opt/dynamo/venv
466471
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
467472

473+
# Install build-essential and python3-dev as apt dependencies
474+
RUN apt-get update && \
475+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
476+
build-essential \
477+
python3-dev && \
478+
rm -rf /var/lib/apt/lists/*
479+
480+
### COPY BINDINGS ###
481+
# Copy all bindings (wheels, lib, include) from ci_minimum
482+
COPY --from=ci_minimum /opt/dynamo/bindings /opt/dynamo/bindings
483+
### COPY NATS & ETCD ###
484+
# Copy nats and etcd from base image
485+
COPY --from=base /usr/bin/nats-server /usr/bin/nats-server
486+
COPY --from=base /usr/local/bin/etcd/ /usr/local/bin/etcd/
487+
488+
# Copy UCX from base image as plugin for NIXL
489+
# Copy NIXL source from base image (required for NIXL plugins)
490+
COPY --from=base /usr/local/ucx /usr/local/ucx
491+
COPY --from=base /usr/local/nixl /usr/local/nixl
492+
ARG ARCH_ALT
493+
ENV NIXL_PLUGIN_DIR=/usr/local/nixl/lib/${ARCH_ALT}-linux-gnu/plugins
494+
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
495+
468496
# Setup the python environment
469497
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
470-
RUN apt-get update && \
471-
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-dev && \
472-
rm -rf /var/lib/apt/lists/* && \
473-
uv venv $VIRTUAL_ENV --python 3.12 && \
498+
RUN uv venv $VIRTUAL_ENV --python 3.12 && \
474499
echo "source $VIRTUAL_ENV/bin/activate" >> ~/.bashrc
475500

501+
# Common dependencies
502+
RUN --mount=type=bind,source=./container/deps/requirements.txt,target=/tmp/requirements.txt \
503+
uv pip install --requirement /tmp/requirements.txt
504+
476505
# Install the wheels and symlink executables to /usr/local/bin so dynamo components can use them
477506
# Dynamo components currently do not have the VIRTUAL_ENV in their PATH, so we need to symlink the executables
507+
#Copy NIXL and Dynamo wheels into wheelhouse
508+
COPY --from=base /workspace/wheels/nixl/*.whl wheelhouse/
478509
COPY --from=wheel_builder /workspace/dist/*.whl wheelhouse/
479510
RUN uv pip install ai-dynamo[vllm] --find-links wheelhouse && \
511+
uv pip install nixl --find-links wheelhouse && \
480512
ln -sf $VIRTUAL_ENV/bin/* /usr/local/bin/ && \
481513
rm -r wheelhouse
482514

0 commit comments

Comments
 (0)