feat: multi-arch build for OCI image (#2032)
I was trying to build the image on arm64 but this image was specifically
made for x86_64.
I propose to make the image available for other architectures. As we are
using docker buildx we can use the `TARGETARCH` argument ([Automatic
platform ARGs in the global
scope](https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope)).
diff --git a/bazel/oci/Dockerfile b/bazel/oci/Dockerfile
index f99995a..036f9de 100644
--- a/bazel/oci/Dockerfile
+++ b/bazel/oci/Dockerfile
@@ -8,7 +8,7 @@
FROM base_image AS downloader
-ARG BAZEL_VERSION
+ARG TARGETARCH BAZEL_VERSION
WORKDIR /var/bazel
RUN --mount=source=bazel/oci/install_bazel.sh,target=/mnt/install_bazel.sh,type=bind \
diff --git a/bazel/oci/install_bazel.sh b/bazel/oci/install_bazel.sh
index c2e1ba4..f5b0e47 100755
--- a/bazel/oci/install_bazel.sh
+++ b/bazel/oci/install_bazel.sh
@@ -6,13 +6,13 @@
--fail \
--location \
--remote-name \
- "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64"
+ "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${TARGETARCH}"
curl \
--fail \
--location \
- "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64.sha256" \
+ "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${TARGETARCH}.sha256" \
| sha256sum --check
-mv "bazel-${BAZEL_VERSION}-linux-x86_64" bazel
+mv "bazel-${BAZEL_VERSION}-linux-${TARGETARCH}" bazel
chmod +x bazel