feat: multiarch builds (#99)

This commit is contained in:
Adam Uhlíř 2022-05-09 11:30:06 +02:00 committed by GitHub
parent bef03cabc8
commit 927405bab3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -31,6 +31,7 @@ env:
COMMIT_VERSION_TAG: 'false'
STATE_COMMIT: 'true'
BEE_VERSION: '${{ github.event.client_payload.tag }}'
BEE_PLATFORM: 'linux/amd64,linux/arm64,linux/arm/v7'
jobs:
bee-images:
@ -45,6 +46,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Override inputs from `workflow_dispatch`
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then

View File

@ -11,10 +11,17 @@ DOCKERFILE
dockerbuild() {
BLOCKCHAIN_VERSION=$("$MY_PATH/utils/env-variable-value.sh" BLOCKCHAIN_VERSION)
PLATFORM_FLAG=""
if [ -n "$BEE_PLATFORM" ]; then
# Multiplatform build needs to push the images right away as docker buildx does not output images loaded into
# docker itself, or it can do that but only for one platform.
PLATFORM_FLAG="--platform=$BEE_PLATFORM --push"
fi
IMAGE_NAME=$(basename "$1")
IMAGE_NAME="$4/$IMAGE_NAME"
docker build "$1" --no-cache -f "$2" -t "$IMAGE_NAME:$3" --label "org.ethswarm.beefactory.blockchain-version=$BLOCKCHAIN_VERSION"
docker build "$1" --no-cache -f "$2" -t "$IMAGE_NAME:$3" $PLATFORM_FLAG --label "org.ethswarm.beefactory.blockchain-version=$BLOCKCHAIN_VERSION"
}
MY_PATH=$(dirname "$0")