Add architecture check for protoc during grid-dev builds
Without this check protoc is installed for the incorrect platform when built
on a machine with an ARM CPU, causing the build to hang indefinitely.
@@ -53,9 +53,15 @@ RUN rustup update \
RUN cargo install cargo-deb
# Install protoc
-RUN curl -OLsS https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-x86_64.zip \
- && unzip -o protoc-3.7.1-linux-x86_64.zip -d /usr/local \
- && rm protoc-3.7.1-linux-x86_64.zip
+RUN TARGET_ARCH=$(dpkg --print-architecture) \
+ && if [[ $TARGET_ARCH == "arm64" ]]; then \
+ PROTOC_ARCH="aarch_64"; \
+ elif [[ $TARGET_ARCH == "amd64" ]]; then \
+ PROTOC_ARCH="x86_64"; \
+ fi \
+ && curl -OLsS https://github.com/google/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-$PROTOC_ARCH.zip \
+ && unzip -o protoc-3.7.1-linux-$PROTOC_ARCH.zip -d /usr/local \
+ && rm protoc-3.7.1-linux-$PROTOC_ARCH.zip
# Install just
RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin
