Skip to content

Commit 1f31807

Browse files
Merge pull request #873 from kaleido-io/multiarch-builds
Use docker buildx for multiarch builds
2 parents 0fe2eca + 6c81519 commit 1f31807

File tree

5 files changed

+51
-69
lines changed

5 files changed

+51
-69
lines changed

.github/workflows/docker_main.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ jobs:
1313
with:
1414
fetch-depth: 0
1515

16+
- name: Set up Docker Buildx
17+
id: buildx
18+
uses: docker/setup-buildx-action@v2
19+
20+
- name: Set up qemu emulators
21+
run: |
22+
docker run --rm --privileged tonistiigi/binfmt --install all
23+
24+
- name: Docker login
25+
run: |
26+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
27+
1628
- name: Set build tag
1729
id: build_tag_generator
1830
run: |
@@ -28,18 +40,7 @@ jobs:
2840
--label commit=$GITHUB_SHA \
2941
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
3042
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
31-
--tag ghcr.io/hyperledger/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }}" \
32-
docker
33-
34-
- name: Tag release
35-
run: docker tag ghcr.io/hyperledger/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly:head
36-
37-
- name: Push docker image
38-
run: |
39-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
40-
docker push ghcr.io/hyperledger/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }}
41-
42-
- name: Push head tag
43-
run: |
44-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
45-
docker push ghcr.io/hyperledger/firefly:head
43+
--tag ghcr.io/hyperledger/firefly:${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
44+
--tag ghcr.io/hyperledger/firefly:head \
45+
--push" \
46+
docker-multiarch

.github/workflows/docker_release.yml

Lines changed: 28 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,67 +12,44 @@ jobs:
1212
with:
1313
fetch-depth: 0
1414

15-
- name: Build
16-
run: |
17-
make DOCKER_ARGS="\
18-
--build-arg BUILD_VERSION=${GITHUB_REF##*/} \
19-
--build-arg GIT_REF=$GITHUB_SHA \
20-
--label commit=$GITHUB_SHA \
21-
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
22-
--label tag=${GITHUB_REF##*/} \
23-
--tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} \
24-
--tag ghcr.io/hyperledger/firefly:head" \
25-
docker
26-
27-
- name: Push docker image
28-
run: |
29-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
30-
docker push ghcr.io/hyperledger/firefly:${GITHUB_REF##*/}
31-
32-
- name: Push head tag
33-
run: |
34-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
35-
docker push ghcr.io/hyperledger/firefly:head
36-
37-
- name: Tag latest release
38-
if: github.event.action == 'released'
39-
run: docker tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly:latest
40-
41-
- name: Push latest tag
15+
- name: Set up Docker Buildx
16+
id: buildx
17+
uses: docker/setup-buildx-action@v2
18+
19+
- name: Set up qemu emulators
20+
run: |
21+
docker run --rm --privileged tonistiigi/binfmt --install all
22+
23+
- name: Set latest tag
4224
if: github.event.action == 'released'
4325
run: |
44-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
45-
docker push ghcr.io/hyperledger/firefly:latest
26+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:latest" >> $GITHUB_ENV
4627
47-
- name: Tag alpha release
28+
- name: Set alpha tag
4829
if: github.event.action == 'prereleased' && contains(github.ref, 'alpha')
4930
run: |
50-
docker tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly:alpha
31+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:alpha" >> $GITHUB_ENV
5132
52-
- name: Push alpha tag
53-
if: github.event.action == 'prereleased' && contains(github.ref, 'alpha')
54-
run: |
55-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
56-
docker push ghcr.io/hyperledger/firefly:alpha
57-
58-
- name: Tag beta release
59-
if: github.event.action == 'prereleased' && contains(github.ref, 'beta')
60-
run: |
61-
docker tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly:beta
62-
63-
- name: Push beta tag
33+
- name: Set beta tag
6434
if: github.event.action == 'prereleased' && contains(github.ref, 'beta')
6535
run: |
66-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
67-
docker push ghcr.io/hyperledger/firefly:beta
36+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:beta" >> $GITHUB_ENV
6837
69-
- name: Tag rc release
38+
- name: Set rc tag
7039
if: github.event.action == 'prereleased' && contains(github.ref, 'rc')
7140
run: |
72-
docker tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly:rc
41+
echo "DOCKER_TAGS=${{ env.DOCKER_TAGS }} --tag ghcr.io/hyperledger/firefly:rc" >> $GITHUB_ENV
7342
74-
- name: Push rc tag
75-
if: github.event.action == 'prereleased' && contains(github.ref, 'rc')
43+
- name: Build
7644
run: |
77-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
78-
docker push ghcr.io/hyperledger/firefly:rc
45+
make DOCKER_ARGS="\
46+
--build-arg BUILD_VERSION=${GITHUB_REF##*/} \
47+
--build-arg GIT_REF=$GITHUB_SHA \
48+
--label commit=$GITHUB_SHA \
49+
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
50+
--label tag=${GITHUB_REF##*/} \
51+
--tag ghcr.io/hyperledger/firefly:${GITHUB_REF##*/} \
52+
--tag ghcr.io/hyperledger/firefly:head \
53+
${{ env.DOCKER_TAGS }}" \
54+
--push
55+
docker-multiarch

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,5 +101,7 @@ manifest:
101101
./manifestgen.sh
102102
docker:
103103
./docker_build.sh $(DOCKER_ARGS)
104+
docker-multiarch:
105+
./docker_build.sh --platform linux/amd64,linux/arm64 $(DOCKER_ARGS)
104106
docs: .ALWAYS
105107
cd docs && bundle install && bundle exec jekyll build && bundle exec htmlproofer --disable-external --allow-hash-href --allow_missing_href true --swap-urls '^/firefly/:/' --ignore-urls /127.0.0.1/,/localhost/ ./_site

docker_build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ echo BASE_TAG=$BASE_TAG
3636
echo UI_TAG=$UI_TAG
3737
echo UI_RELEASE=$UI_RELEASE
3838

39-
docker build \
39+
docker buildx create --name firefly --use
40+
docker buildx build \
4041
-t hyperledger/firefly \
4142
--build-arg FIREFLY_BUILDER_TAG=$FIREFLY_BUILDER_TAG \
4243
--build-arg FABRIC_BUILDER_TAG=$FABRIC_BUILDER_TAG \
@@ -46,4 +47,5 @@ docker build \
4647
--build-arg UI_TAG=$UI_TAG \
4748
--build-arg UI_RELEASE=$UI_RELEASE \
4849
$@ \
49-
.
50+
.
51+
docker buildx rm firefly

test/e2e/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ fi
7575
cd $CWD
7676

7777
if [ "$BUILD_FIREFLY" == "true" ]; then
78-
make -C ../.. docker
78+
make -C ../.. DOCKER_ARGS="--load" docker
7979
checkOk $?
8080
fi
8181

0 commit comments

Comments
 (0)