Skip to content

Commit

Permalink
Build aarch64-linux image under QEMU emulation for linux/arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
stanhu committed Apr 11, 2022
1 parent d9adb49 commit 07d69a3
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,35 @@ jobs:
ruby-version: "3.0"
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
if: matrix.platform == 'aarch64-linux'

- name: Enable Multiarch
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
if: matrix.platform == 'aarch64-linux'

- name: Create builder
run: |
docker buildx create --name mbuilder
docker buildx use mbuilder
docker buildx inspect
docker buildx ls
if: matrix.platform == 'aarch64-linux'

- name: Export Docker Buildx arguments
run: |
echo "DOCKER_BUILDX_ARGS=--platform=linux/arm64" >> $GITHUB_ENV
if: matrix.platform == 'aarch64-linux'

- name: Build docker image
run: |
docker buildx create --driver docker-container --use
bundle exec rake build:${PLATFORM} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load"
bundle exec rake build:${PLATFORM} RCD_DOCKER_BUILD="docker buildx build ${DOCKER_BUILDX_ARGS} --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load"
- name: Move build cache and remove outdated layers
run: |
Expand Down

0 comments on commit 07d69a3

Please sign in to comment.