Skip to content

Commit 2c072a4

Browse files
committed
Don't install protoc from source anymore
1 parent 2ffc48a commit 2c072a4

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

Dockerfile-build-wheel.arm64

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
FROM quay.io/pypa/manylinux_2_28_aarch64 AS base
4+
ARG TARGETARCH
45

56
WORKDIR /root
67

@@ -9,16 +10,23 @@ RUN <<EOF
910
dnf install -y curl pkg-config openssl ca-certificates openssl-devel patchelf autoconf automake make libtool unzip clang libatomic openssh-clients wget
1011
EOF
1112

13+
# Install a newer version of protoc than is available in rocky linux
14+
ARG PROTOC_VERSION=29.3
1215
RUN <<EOF
13-
# echo 1
14-
wget https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.zip
15-
unzip v3.21.12.zip
16-
cd protobuf-3.21.12
17-
autoupdate
18-
./autogen.sh
19-
./configure --prefix=/usr --disable-dependency-tracking
20-
make -j8
21-
make install
16+
set -e
17+
if [ "${TARGETARCH}" = "amd64" ]; then
18+
PROTOC_ARCH=x86_64
19+
elif [ "${TARGETARCH}" = "arm64" ]; then
20+
PROTOC_ARCH=aarch_64
21+
else
22+
echo "Unsupported architecture: ${TARGETARCH}"
23+
exit 1
24+
fi
25+
PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-$PROTOC_ARCH.zip
26+
wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/$PROTOC_ZIP
27+
unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc
28+
unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*'
29+
rm -f "$PROTOC_ZIP"
2230
EOF
2331

2432
RUN <<EOF
@@ -44,7 +52,7 @@ RUN --mount=type=bind,source=src,target=src,readwrite \
4452
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry/ \
4553
--mount=type=ssh,mode=0666 \
4654
<<EOF
47-
export PATH="/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
55+
export PATH="/usr/local/bin:/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
4856
python3 -m venv venv
4957
source venv/bin/activate
5058
source /root/.cargo/env

Dockerfile-build-wheel.x86_64

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# syntax=docker/dockerfile:1
22

33
FROM quay.io/pypa/manylinux_2_28_x86_64 AS base
4+
ARG TARGETARCH
45

56
WORKDIR /root
67

@@ -9,16 +10,23 @@ RUN <<EOF
910
dnf install -y curl pkg-config openssl ca-certificates openssl-devel patchelf autoconf automake make libtool unzip clang libatomic openssh-clients wget
1011
EOF
1112

13+
# Install a newer version of protoc than is available in rocky linux
14+
ARG PROTOC_VERSION=29.3
1215
RUN <<EOF
13-
# echo 1
14-
wget https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.zip
15-
unzip v3.21.12.zip
16-
cd protobuf-3.21.12
17-
autoupdate
18-
./autogen.sh
19-
./configure --prefix=/usr --disable-dependency-tracking
20-
make -j8
21-
make install
16+
set -e
17+
if [ "${TARGETARCH}" = "amd64" ]; then
18+
PROTOC_ARCH=x86_64
19+
elif [ "${TARGETARCH}" = "arm64" ]; then
20+
PROTOC_ARCH=aarch_64
21+
else
22+
echo "Unsupported architecture: ${TARGETARCH}"
23+
exit 1
24+
fi
25+
PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-$PROTOC_ARCH.zip
26+
wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/$PROTOC_ZIP
27+
unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc
28+
unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*'
29+
rm -f "$PROTOC_ZIP"
2230
EOF
2331

2432
RUN <<EOF
@@ -44,7 +52,7 @@ RUN --mount=type=bind,source=src,target=src,readwrite \
4452
--mount=type=cache,mode=0777,target=/usr/local/cargo/registry/ \
4553
--mount=type=ssh,mode=0666 \
4654
<<EOF
47-
export PATH="/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
55+
export PATH="/usr/local/bin:/root/.cargo/bin:/opt/python/cp312-cp312/bin:$PATH"
4856
python3 -m venv venv
4957
source venv/bin/activate
5058
source /root/.cargo/env

0 commit comments

Comments
 (0)