Skip to content

Commit

Permalink
feat(multiarch): enable cross-platform docker image generation via do…
Browse files Browse the repository at this point in the history
…cker buildx (#11)

* feat(multiarch): enable cross-platform docker image generation via docker buildx

* feat(multiarch): enable cross-platform docker image generation via docker buildx
  • Loading branch information
missinglink committed Nov 30, 2023
1 parent ce916cc commit 199fea6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build-docker-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,19 @@ if [[ "$BRANCH" == "master" ]]; then
done
fi

# default build targets can be configured with the DOCKER_BUILD_PLATFORMS env var
DOCKER_BUILD_DEFAULT_PLATFORMS='linux/amd64,linux/arm64,linux/arm/v7'
DOCKER_BUILD_PLATFORMS=${DOCKER_BUILD_PLATFORMS:-$DOCKER_BUILD_DEFAULT_PLATFORMS}

# log in to Docker Hub _before_ building to avoid rate limits
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

# Build and push each tag (the built image will be reused after the first build)
for tag in ${tags[@]}; do
docker build -t $tag .
docker push $tag
if [ $DOCKER_BUILD_PLATFORMS == "classic" ]; then
docker build -t $tag .
docker push $tag
else
docker buildx build --push --platform="$DOCKER_BUILD_PLATFORMS" -t $tag .
fi
done

0 comments on commit 199fea6

Please sign in to comment.