@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / caf69823d6
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 3, 03:00 UTC

[CI] Pin protoc binary in rust-build stages (#43292)

Signed-off-by: haosdent <haosdent@gmail.com>

haosdent committed May 21, 2026 at 18:38 UTC caf69823d61119ac3f4b066f20a910b62078e41c
6 files changed +60 -14
docker/Dockerfile
+7 -6
@@ -240,21 +240,22 @@ ARG BUILD_OS
240
241 ENV DEBIAN_FRONTEND=noninteractive
242
243 -# Install protoc (used by tonic-build/prost-build) and a basic C toolchain
244 -# (some rust crates compile C in their build.rs scripts).
243 +# Install a basic C toolchain (some rust crates compile C in their build.rs
244 +# scripts) and unzip (used to extract the pinned protoc release below).
245 RUN if [ "${BUILD_OS}" = "manylinux" ]; then \
246 dnf install -y --setopt=install_weak_deps=False \
247 - ca-certificates curl git gcc gcc-c++ make \
248 - protobuf-compiler protobuf-devel \
247 + ca-certificates curl git gcc gcc-c++ make unzip \
248 && dnf clean all && rm -rf /var/cache/dnf; \
249 else \
250 apt-get update -y \
251 && apt-get install -y --no-install-recommends \
253 - ca-certificates curl git build-essential \
254 - protobuf-compiler libprotobuf-dev \
252 + ca-certificates curl git build-essential unzip \
253 && rm -rf /var/lib/apt/lists/*; \
254 fi
255
256 +COPY tools/install_protoc.sh /tmp/install_protoc.sh
257 +RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
258 +
259 # Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
260 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
261 sh -s -- -y --profile minimal --default-toolchain none
docker/Dockerfile.cpu
+4 -2
@@ -90,10 +90,12 @@ ENV DEBIAN_FRONTEND=noninteractive
90
91 RUN apt-get update -y \
92 && apt-get install -y --no-install-recommends \
93 - ca-certificates curl git build-essential \
94 - protobuf-compiler libprotobuf-dev \
93 + ca-certificates curl git build-essential unzip \
94 && rm -rf /var/lib/apt/lists/*
95
96 +COPY tools/install_protoc.sh /tmp/install_protoc.sh
97 +RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
98 +
99 # Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
100 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
101 sh -s -- -y --profile minimal --default-toolchain none
docker/Dockerfile.nightly_torch
+4 -2
@@ -102,10 +102,12 @@ ENV DEBIAN_FRONTEND=noninteractive
102
103 RUN apt-get update -y \
104 && apt-get install -y --no-install-recommends \
105 - ca-certificates curl git build-essential \
106 - protobuf-compiler libprotobuf-dev \
105 + ca-certificates curl git build-essential unzip \
106 && rm -rf /var/lib/apt/lists/*
107
108 +COPY tools/install_protoc.sh /tmp/install_protoc.sh
109 +RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
110 +
111 # Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
112 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
113 sh -s -- -y --profile minimal --default-toolchain none
docker/Dockerfile.rocm
+4 -2
@@ -130,11 +130,13 @@ RUN if [ ! -f ${COMMON_WORKDIR}/vllm/rust/Cargo.toml ]; then \
130 exit 1; \
131 fi
132
133 -# protoc is used by tonic-build/prost-build.
133 RUN apt-get update -q -y && apt-get install -q -y --no-install-recommends \
135 - protobuf-compiler libprotobuf-dev \
134 + ca-certificates curl unzip \
135 && rm -rf /var/lib/apt/lists/*
136
137 +COPY tools/install_protoc.sh /tmp/install_protoc.sh
138 +RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
139 +
140 # Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
141 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
142 sh -s -- -y --profile minimal --default-toolchain none
docker/Dockerfile.xpu
+4 -2
@@ -6,10 +6,12 @@ ENV DEBIAN_FRONTEND=noninteractive
6
7 RUN apt-get update -y \
8 && apt-get install -y --no-install-recommends \
9 - ca-certificates curl git build-essential \
10 - protobuf-compiler libprotobuf-dev \
9 + ca-certificates curl git build-essential unzip \
10 && rm -rf /var/lib/apt/lists/*
11
12 +COPY tools/install_protoc.sh /tmp/install_protoc.sh
13 +RUN /tmp/install_protoc.sh && rm /tmp/install_protoc.sh
14 +
15 # Install rustup; the toolchain itself is pinned by rust/rust-toolchain.toml.
16 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
17 sh -s -- -y --profile minimal --default-toolchain none
tools/install_protoc.sh new
+37
@@ -0,0 +1,37 @@
1 +#!/usr/bin/env bash
2 +set -euo pipefail
3 +
4 +# Install a pinned protoc binary from upstream GitHub releases.
5 +#
6 +# Distro protobuf-compiler packages vary widely in version (e.g.
7 +# AlmaLinux/RHEL 8 ships protoc 3.5, predating the
8 +# --experimental_allow_proto3_optional flag the rust frontend's build.rs
9 +# passes), so we pin the protoc version here instead.
10 +#
11 +# Override the version via the PROTOC_VERSION env var.
12 +# Requires: curl, unzip, root privileges.
13 +
14 +if [[ $(id -u) -ne 0 ]]; then
15 + echo "Must be run as root" >&2
16 + exit 1
17 +fi
18 +
19 +VERSION="${PROTOC_VERSION:-34.2}"
20 +
21 +ARCH="$(uname -m)"
22 +case "${ARCH}" in
23 + # protoc release archives use "aarch_64" (with an underscore), not
24 + # "aarch64". Don't "fix" this.
25 + aarch64|arm64) URL_ARCH="aarch_64" ;;
26 + x86_64|amd64) URL_ARCH="x86_64" ;;
27 + *) echo "Unsupported arch for protoc binary: ${ARCH}" >&2; exit 1 ;;
28 +esac
29 +
30 +URL="https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-${URL_ARCH}.zip"
31 +TMPDIR="$(mktemp -d)"
32 +trap 'rm -rf "${TMPDIR}"' EXIT
33 +
34 +echo "Downloading: ${URL}"
35 +curl -fsSL -o "${TMPDIR}/protoc.zip" "${URL}"
36 +unzip -q -o "${TMPDIR}/protoc.zip" -d /usr/local
37 +echo "Installed $(protoc --version)"