Skip to content

Commit

Permalink
feat: multi-arch build for OCI image (#2032)
Browse files Browse the repository at this point in the history
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)).
  • Loading branch information
Clement-Jean authored Sep 3, 2024
1 parent f3626a8 commit e4e437c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bazel/oci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN --mount=source=bazel/oci/install_packages.sh,target=/mnt/install_packages.sh

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 \
Expand Down
6 changes: 3 additions & 3 deletions bazel/oci/install_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ curl \
--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

0 comments on commit e4e437c

Please sign in to comment.