Skip to content

Commit

Permalink
Build multi-arch Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Sep 24, 2024
1 parent 1503825 commit 4669c13
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions release-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,37 @@ echo "========================================================"
echo "Building Docker image for Rally release $RALLY_VERSION "
echo "========================================================"

docker build -t elastic/rally:${RALLY_VERSION} --build-arg RALLY_VERSION --build-arg RALLY_LICENSE -f docker/Dockerfiles/Dockerfile-release $PWD
# Create builder that supports QEMU emulation (needed for linux/arm64)
docker buildx rm --force rally-multiarch-builder || true
docker buildx create --name rally-multiarch-builder --bootstrap --use
docker buildx build --load \
--tag elastic/rally:${RALLY_VERSION} \
--build-arg RALLY_VERSION --build-arg RALLY_LICENSE \
--file docker/Dockerfiles/Dockerfile-release \
--platform linux/amd64 \
"$PWD"

echo "======================================================="
echo "Testing Docker image for Rally release $RALLY_VERSION "
echo "======================================================="

./release-docker-test.sh

echo "======================================================="
echo "Publishing Docker image elastic/rally:$RALLY_VERSION "
echo "======================================================="
echo "=======================
echo "Publishing Docker image
echo "=======================
trap push_failed ERR
docker push elastic/rally:${RALLY_VERSION}

echo "============================================"
echo "Publishing Docker image elastic/rally:latest"
echo "============================================"
docker tag elastic/rally:${RALLY_VERSION} elastic/rally:latest
docker push elastic/rally:latest
# Multi-arch images have to be pushed immediately forcing us to rebuild here to
# add arm64 - https://github.com/docker/buildx/issues/59
docker buildx build \
--push \
--tag elastic/rally:${RALLY_VERSION} \
--tag elastic/rally:latest \
--build-arg RALLY_VERSION --build-arg RALLY_LICENSE \
--file docker/Dockerfiles/Dockerfile-release \
--platform linux/amd64,linux/arm64 \
"$PWD"
trap - ERR

0 comments on commit 4669c13

Please sign in to comment.