[Rust Frontend] Move code from vllm-frontend-rs (#43283)
Signed-off-by: Bugen Zhao <i@bugenzhao.com> Signed-off-by: Nick Hill <nickhill123@gmail.com> Signed-off-by: Eric Curtin <eric.curtin@docker.com> Signed-off-by: Dev-X25874 <283057883+Dev-X25874@users.noreply.github.com> Signed-off-by: Will.hou <1205157517@qq.com> Signed-off-by: Will.hou <willamhou@ceresman.com> Co-authored-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Eric Curtin <eric.curtin@docker.com> Co-authored-by: Dev-X25874 <283057883+Dev-X25874@users.noreply.github.com> Co-authored-by: Will.hou <1205157517@qq.com> Co-authored-by: Will.hou <willamhou@ceresman.com> Please see https://github.com/Inferact/vllm-frontend-rs for full original commit history.
This commit is contained in:
co-authored by
Nick Hill
Eric Curtin
Dev-X25874
Will.hou
Will.hou
parent
39d5fa96a7
commit
39910f2b25
+4
-12
@@ -256,7 +256,7 @@ RUN if [ "${BUILD_OS}" = "manylinux" ]; then \
|
||||
COPY tools/install_protoc.sh /tmp/install_protoc.sh
|
||||
RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
|
||||
|
||||
# Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
|
||||
# Install rustup; the toolchain itself is pinned by rust-toolchain.toml.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --profile minimal --default-toolchain none
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
@@ -265,14 +265,8 @@ WORKDIR /workspace
|
||||
|
||||
# Copy only the rust workspace — the binary is the sole artifact we need.
|
||||
COPY rust rust
|
||||
|
||||
# Fail loudly if the rust submodule was not initialized on the host before
|
||||
# `docker build`. Without this check, cargo would emit a confusing error.
|
||||
RUN if [ ! -f rust/Cargo.toml ]; then \
|
||||
echo "ERROR: rust/ submodule is not initialized."; \
|
||||
echo "Run 'git submodule update --init --recursive' on the host before building."; \
|
||||
exit 1; \
|
||||
fi
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY build_rust.sh build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -284,9 +278,7 @@ ENV CARGO_BUILD_JOBS=4
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry \
|
||||
--mount=type=cache,target=/root/.cargo/git \
|
||||
--mount=type=cache,target=/workspace/rust/target \
|
||||
cd rust \
|
||||
&& cargo build --release --bin vllm-rs --features native-tls-vendored \
|
||||
&& cp target/release/vllm-rs /workspace/vllm-rs
|
||||
VLLM_RS_TARGET_PATH=/workspace/vllm-rs bash build_rust.sh
|
||||
#################### RUST BUILD IMAGE ####################
|
||||
|
||||
#################### CSRC BUILD IMAGE ####################
|
||||
|
||||
+4
-12
@@ -96,7 +96,7 @@ RUN apt-get update -y \
|
||||
COPY tools/install_protoc.sh /tmp/install_protoc.sh
|
||||
RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
|
||||
|
||||
# Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
|
||||
# Install rustup; the toolchain itself is pinned by rust-toolchain.toml.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --profile minimal --default-toolchain none
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
@@ -105,14 +105,8 @@ WORKDIR /workspace
|
||||
|
||||
# Copy only the rust workspace — the binary is the sole artifact we need.
|
||||
COPY rust rust
|
||||
|
||||
# Fail loudly if the rust submodule was not initialized on the host before
|
||||
# `docker build`. Without this check, cargo would emit a confusing error.
|
||||
RUN if [ ! -f rust/Cargo.toml ]; then \
|
||||
echo "ERROR: rust/ submodule is not initialized."; \
|
||||
echo "Run 'git submodule update --init --recursive' on the host before building."; \
|
||||
exit 1; \
|
||||
fi
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY build_rust.sh build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -124,9 +118,7 @@ ENV CARGO_BUILD_JOBS=4
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry \
|
||||
--mount=type=cache,target=/root/.cargo/git \
|
||||
--mount=type=cache,target=/workspace/rust/target \
|
||||
cd rust \
|
||||
&& cargo build --release --bin vllm-rs --features native-tls-vendored \
|
||||
&& cp target/release/vllm-rs /workspace/vllm-rs
|
||||
VLLM_RS_TARGET_PATH=/workspace/vllm-rs bash build_rust.sh
|
||||
|
||||
######################### BUILD IMAGE #########################
|
||||
FROM base AS vllm-build
|
||||
|
||||
@@ -108,7 +108,7 @@ RUN apt-get update -y \
|
||||
COPY tools/install_protoc.sh /tmp/install_protoc.sh
|
||||
RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
|
||||
|
||||
# Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
|
||||
# Install rustup; the toolchain itself is pinned by rust-toolchain.toml.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --profile minimal --default-toolchain none
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
@@ -116,14 +116,8 @@ ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
WORKDIR /workspace
|
||||
|
||||
COPY rust rust
|
||||
|
||||
# Fail loudly if the rust submodule was not initialized on the host before
|
||||
# `docker build`.
|
||||
RUN if [ ! -f rust/Cargo.toml ]; then \
|
||||
echo "ERROR: rust/ submodule is not initialized."; \
|
||||
echo "Run 'git submodule update --init --recursive' on the host before building."; \
|
||||
exit 1; \
|
||||
fi
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY build_rust.sh build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -132,9 +126,7 @@ ENV CARGO_BUILD_JOBS=4
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry \
|
||||
--mount=type=cache,target=/root/.cargo/git \
|
||||
--mount=type=cache,target=/workspace/rust/target \
|
||||
cd rust \
|
||||
&& cargo build --release --bin vllm-rs --features native-tls-vendored \
|
||||
&& cp target/release/vllm-rs /workspace/vllm-rs
|
||||
VLLM_RS_TARGET_PATH=/workspace/vllm-rs bash build_rust.sh
|
||||
#################### RUST BUILD IMAGE ####################
|
||||
|
||||
#################### WHEEL BUILD IMAGE ####################
|
||||
|
||||
+4
-15
@@ -106,7 +106,6 @@ ONBUILD RUN git clone ${VLLM_REPO} \
|
||||
&& cd vllm \
|
||||
&& git fetch -v --prune -- origin ${VLLM_BRANCH} \
|
||||
&& git checkout FETCH_HEAD \
|
||||
&& git submodule update --init --recursive \
|
||||
&& if [ ${VLLM_REPO} != "https://github.com/vllm-project/vllm.git" ] ; then \
|
||||
git remote add upstream "https://github.com/vllm-project/vllm.git" \
|
||||
&& git fetch upstream ; fi
|
||||
@@ -120,16 +119,7 @@ FROM fetch_vllm_${REMOTE_VLLM} AS fetch_vllm
|
||||
FROM fetch_vllm AS rust-build
|
||||
ARG COMMON_WORKDIR
|
||||
|
||||
# Fail loudly if the rust submodule was not initialized on the host before
|
||||
# `docker build`. The rust frontend source is brought in via the fetch_vllm
|
||||
# stage, so an uninitialized submodule would otherwise produce a confusing
|
||||
# cargo failure.
|
||||
RUN if [ ! -f ${COMMON_WORKDIR}/vllm/rust/Cargo.toml ]; then \
|
||||
echo "ERROR: rust/ submodule is not initialized."; \
|
||||
echo "Run 'git submodule update --init --recursive' on the host before building."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# protoc is used by tonic-build/prost-build.
|
||||
RUN apt-get update -q -y && apt-get install -q -y --no-install-recommends \
|
||||
ca-certificates curl unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
@@ -137,7 +127,7 @@ RUN apt-get update -q -y && apt-get install -q -y --no-install-recommends \
|
||||
COPY tools/install_protoc.sh /tmp/install_protoc.sh
|
||||
RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
|
||||
|
||||
# Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
|
||||
# Install rustup; the toolchain itself is pinned by rust-toolchain.toml.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --profile minimal --default-toolchain none
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
@@ -150,9 +140,8 @@ ENV CARGO_BUILD_JOBS=4
|
||||
# so it persists into the image layer for later COPY --from=rust-build.
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry \
|
||||
--mount=type=cache,target=/root/.cargo/git \
|
||||
cd ${COMMON_WORKDIR}/vllm/rust \
|
||||
&& cargo build --release --bin vllm-rs --features native-tls-vendored \
|
||||
&& cp target/release/vllm-rs /tmp/vllm-rs
|
||||
cd ${COMMON_WORKDIR}/vllm \
|
||||
&& VLLM_RS_TARGET_PATH=/tmp/vllm-rs bash build_rust.sh
|
||||
|
||||
# -----------------------
|
||||
# vLLM build stages
|
||||
|
||||
+4
-12
@@ -12,7 +12,7 @@ RUN apt-get update -y \
|
||||
COPY tools/install_protoc.sh /tmp/install_protoc.sh
|
||||
RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
|
||||
|
||||
# Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
|
||||
# Install rustup; the toolchain itself is pinned by rust-toolchain.toml.
|
||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||
sh -s -- -y --profile minimal --default-toolchain none
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
@@ -20,14 +20,8 @@ ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
WORKDIR /workspace
|
||||
|
||||
COPY rust rust
|
||||
|
||||
# Fail loudly if the rust submodule was not initialized on the host before
|
||||
# `docker build`.
|
||||
RUN if [ ! -f rust/Cargo.toml ]; then \
|
||||
echo "ERROR: rust/ submodule is not initialized."; \
|
||||
echo "Run 'git submodule update --init --recursive' on the host before building."; \
|
||||
exit 1; \
|
||||
fi
|
||||
COPY rust-toolchain.toml rust-toolchain.toml
|
||||
COPY build_rust.sh build_rust.sh
|
||||
|
||||
# Cap cargo parallelism to avoid exhausting the CI host's open-file limit
|
||||
# (rustc spawns enough concurrent processes to hit RLIMIT_NOFILE otherwise).
|
||||
@@ -36,9 +30,7 @@ ENV CARGO_BUILD_JOBS=4
|
||||
RUN --mount=type=cache,target=/root/.cargo/registry \
|
||||
--mount=type=cache,target=/root/.cargo/git \
|
||||
--mount=type=cache,target=/workspace/rust/target \
|
||||
cd rust \
|
||||
&& cargo build --release --bin vllm-rs --features native-tls-vendored \
|
||||
&& cp target/release/vllm-rs /workspace/vllm-rs
|
||||
VLLM_RS_TARGET_PATH=/workspace/vllm-rs bash build_rust.sh
|
||||
|
||||
FROM intel/deep-learning-essentials:2025.3.2-0-devel-ubuntu24.04 AS vllm-base
|
||||
|
||||
|
||||
Reference in New Issue
Block a user