Skip to content

Commit 8896cce

Browse files
authored
Build & push Docker image manifest that includes Aarch64 (#171)
1 parent 12ebb04 commit 8896cce

File tree

3 files changed

+37
-7
lines changed

3 files changed

+37
-7
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,35 @@ jobs:
3131
with:
3232
username: ${{ secrets.DOCKERHUB_USERNAME }}
3333
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v1
37+
3438
# TODO: Add docker layer caching when GitHub Actions cache is stabilized and works good with "satackey/action-docker-layer-caching@v0.0.11"
3539
- name: Build and push
36-
id: docker_build
37-
uses: docker/build-push-action@v2
38-
with:
39-
push: true
40-
tags: ${{ env.GH_REPO }}:latest,${{ env.GH_REPO }}:${{ env.RELEASE_VERSION }}
40+
run: |
41+
set -x
42+
export DOCKER_BUILDKIT=1
43+
44+
BASE_IMAGE="${{ env.GH_REPO }}:${{ env.RELEASE_VERSION }}"
45+
LATEST_IMAGE="${{ env.GH_REPO }}:latest"
46+
X86_64_IMAGE="$BASE_IMAGE-x86_64"
47+
AARCH64_IMAGE="$BASE_IMAGE-aarch64"
48+
49+
# build & push Aarch64
50+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
51+
docker buildx create --name multiarch --driver docker-container --use
52+
./scripts/build_aarch64_container.sh -t "$AARCH64_IMAGE" --push
53+
54+
# build & push x86_64
55+
docker build -t "$X86_64_IMAGE" .
56+
docker push "$X86_64_IMAGE"
57+
58+
# create manifests for the tag + for 'latest'
59+
docker manifest create "$BASE_IMAGE" "$X86_64_IMAGE" "$AARCH64_IMAGE"
60+
docker manifest push "$BASE_IMAGE"
61+
docker manifest create "$LATEST_IMAGE" "$X86_64_IMAGE" "$AARCH64_IMAGE"
62+
docker manifest push "$LATEST_IMAGE"
4163
4264
- name: Image digest
4365
run: echo ${{ steps.docker_build.outputs.digest }}

scripts/build_aarch64_container.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ docker buildx build --platform=linux/arm64 \
2222
--build-arg AP_BUILDER_CENTOS=$CENTOS_VERSION \
2323
--build-arg BURN_BUILDER_GOLANG=$GOLANG_VERSION \
2424
--build-arg GPROFILER_BUILDER_UBUNTU=$UBUNTU_VERSION \
25-
.
25+
. $@

scripts/libunwind_build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@ tar -xf libunwind-1.5.0.tar.gz
1111
curl https://github.com/libunwind/libunwind/commit/831459ee961e7d673bbd83e40d0823227c66db33.patch | sed s/unw_ltoa/ltoa/g > libunwind-container-support.patch
1212
pushd libunwind-1.5.0
1313
patch -p1 < ../libunwind-container-support.patch
14-
./configure --prefix=/usr --disable-tests --disable-documentation && make install -j
14+
15+
if [ $(uname -m) = "aarch64" ]; then
16+
# higher value for make -j kills the GH runner (build gets OOM)
17+
nproc=2
18+
else
19+
nproc=
20+
fi
21+
22+
./configure --prefix=/usr --disable-tests --disable-documentation && make install -j $nproc
1523
popd
1624
rm -r libunwind-1.5.0
1725
rm libunwind-1.5.0.tar.gz

0 commit comments

Comments
 (0)