[CI] Pin protoc binary in rust-build stages (#43292)
Signed-off-by: haosdent <haosdent@gmail.com>
This commit is contained in:
+7
-6
@@ -240,21 +240,22 @@ ARG BUILD_OS
|
|||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Install protoc (used by tonic-build/prost-build) and a basic C toolchain
|
# Install a basic C toolchain (some rust crates compile C in their build.rs
|
||||||
# (some rust crates compile C in their build.rs scripts).
|
# scripts) and unzip (used to extract the pinned protoc release below).
|
||||||
RUN if [ "${BUILD_OS}" = "manylinux" ]; then \
|
RUN if [ "${BUILD_OS}" = "manylinux" ]; then \
|
||||||
dnf install -y --setopt=install_weak_deps=False \
|
dnf install -y --setopt=install_weak_deps=False \
|
||||||
ca-certificates curl git gcc gcc-c++ make \
|
ca-certificates curl git gcc gcc-c++ make unzip \
|
||||||
protobuf-compiler protobuf-devel \
|
|
||||||
&& dnf clean all && rm -rf /var/cache/dnf; \
|
&& dnf clean all && rm -rf /var/cache/dnf; \
|
||||||
else \
|
else \
|
||||||
apt-get update -y \
|
apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates curl git build-essential \
|
ca-certificates curl git build-essential unzip \
|
||||||
protobuf-compiler libprotobuf-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*; \
|
&& rm -rf /var/lib/apt/lists/*; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
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/rust-toolchain.toml.
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
sh -s -- -y --profile minimal --default-toolchain none
|
sh -s -- -y --profile minimal --default-toolchain none
|
||||||
|
|||||||
@@ -90,10 +90,12 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
RUN apt-get update -y \
|
RUN apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates curl git build-essential \
|
ca-certificates curl git build-essential unzip \
|
||||||
protobuf-compiler libprotobuf-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
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/rust-toolchain.toml.
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
sh -s -- -y --profile minimal --default-toolchain none
|
sh -s -- -y --profile minimal --default-toolchain none
|
||||||
|
|||||||
@@ -102,10 +102,12 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
RUN apt-get update -y \
|
RUN apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates curl git build-essential \
|
ca-certificates curl git build-essential unzip \
|
||||||
protobuf-compiler libprotobuf-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
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/rust-toolchain.toml.
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
sh -s -- -y --profile minimal --default-toolchain none
|
sh -s -- -y --profile minimal --default-toolchain none
|
||||||
|
|||||||
@@ -130,11 +130,13 @@ RUN if [ ! -f ${COMMON_WORKDIR}/vllm/rust/Cargo.toml ]; then \
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# protoc is used by tonic-build/prost-build.
|
|
||||||
RUN apt-get update -q -y && apt-get install -q -y --no-install-recommends \
|
RUN apt-get update -q -y && apt-get install -q -y --no-install-recommends \
|
||||||
protobuf-compiler libprotobuf-dev \
|
ca-certificates curl unzip \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
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/rust-toolchain.toml.
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
sh -s -- -y --profile minimal --default-toolchain none
|
sh -s -- -y --profile minimal --default-toolchain none
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ ENV DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
RUN apt-get update -y \
|
RUN apt-get update -y \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates curl git build-essential \
|
ca-certificates curl git build-essential unzip \
|
||||||
protobuf-compiler libprotobuf-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
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/rust-toolchain.toml.
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
sh -s -- -y --profile minimal --default-toolchain none
|
sh -s -- -y --profile minimal --default-toolchain none
|
||||||
|
|||||||
Executable
+37
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Install a pinned protoc binary from upstream GitHub releases.
|
||||||
|
#
|
||||||
|
# Distro protobuf-compiler packages vary widely in version (e.g.
|
||||||
|
# AlmaLinux/RHEL 8 ships protoc 3.5, predating the
|
||||||
|
# --experimental_allow_proto3_optional flag the rust frontend's build.rs
|
||||||
|
# passes), so we pin the protoc version here instead.
|
||||||
|
#
|
||||||
|
# Override the version via the PROTOC_VERSION env var.
|
||||||
|
# Requires: curl, unzip, root privileges.
|
||||||
|
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
|
echo "Must be run as root" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION="${PROTOC_VERSION:-34.2}"
|
||||||
|
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
case "${ARCH}" in
|
||||||
|
# protoc release archives use "aarch_64" (with an underscore), not
|
||||||
|
# "aarch64". Don't "fix" this.
|
||||||
|
aarch64|arm64) URL_ARCH="aarch_64" ;;
|
||||||
|
x86_64|amd64) URL_ARCH="x86_64" ;;
|
||||||
|
*) echo "Unsupported arch for protoc binary: ${ARCH}" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
URL="https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/protoc-${VERSION}-linux-${URL_ARCH}.zip"
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "${TMPDIR}"' EXIT
|
||||||
|
|
||||||
|
echo "Downloading: ${URL}"
|
||||||
|
curl -fsSL -o "${TMPDIR}/protoc.zip" "${URL}"
|
||||||
|
unzip -q -o "${TMPDIR}/protoc.zip" -d /usr/local
|
||||||
|
echo "Installed $(protoc --version)"
|
||||||
Reference in New Issue
Block a user