This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new bb86dd0fe AVRO-4021: Pass in BUILDPLATFORM explicitly (#3026)
bb86dd0fe is described below

commit bb86dd0fe1d604b9f741697e424040094b5a02bf
Author: Fokko Driesprong <[email protected]>
AuthorDate: Mon Jul 22 22:07:06 2024 +0200

    AVRO-4021: Pass in BUILDPLATFORM explicitly (#3026)
---
 build.sh                | 4 +++-
 share/docker/Dockerfile | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh
index 98e894b00..07c1b2a7d 100755
--- a/build.sh
+++ b/build.sh
@@ -309,9 +309,11 @@ do
         echo "RUN getent passwd $USER_ID || useradd -g $GROUP_ID -u $USER_ID 
-k /root -m $USER_NAME"
         echo "RUN mkdir -p /home/$USER_NAME/.m2/repository"
       } > Dockerfile
+
+      export BUILDPLATFORM=$(docker info --format 
"{{.OSType}}/{{.Architecture}}")
       # Include the ruby gemspec for preinstallation.
       # shellcheck disable=SC2086
-      tar -cf- Dockerfile $DOCKER_EXTRA_CONTEXT | DOCKER_BUILDKIT=1 docker 
build $DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
+      tar -cf- Dockerfile $DOCKER_EXTRA_CONTEXT | DOCKER_BUILDKIT=1 docker 
build $DOCKER_BUILD_XTRA_ARGS --build-arg="BUILDPLATFORM=${BUILDPLATFORM}" -t 
"$DOCKER_IMAGE_NAME" -
       rm Dockerfile
       # By mapping the .m2/repository directory you can do an mvn install from
       # within the container and use the result on your normal
diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile
index 0d9d7ace1..c745608ae 100644
--- a/share/docker/Dockerfile
+++ b/share/docker/Dockerfile
@@ -17,7 +17,9 @@
 # Dockerfile for installing the necessary dependencies for building Avro.
 # See BUILD.md.
 
-FROM ubuntu:22.04
+ARG BUILDPLATFORM
+
+FROM --platform=$BUILDPLATFORM ubuntu:22.04
 WORKDIR /root
 
 ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=isolemnlysweariamuptonogood \

Reply via email to