From 4cd6a5d96ab1efee9b6893d781c8af9d3d2f56e2 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 15 Dec 2021 00:09:46 +0000 Subject: [PATCH] DEV: Fix aarch64 build (#592) buildx can't build `FROM` a local image, so we need to set up a temporary local registry for the intermediate image --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++---- image/base/release.Dockerfile | 3 ++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1e5279d..e994a4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,6 +114,11 @@ jobs: aarch64: runs-on: [ubuntu-20.04] needs: base + services: + registry: + image: registry + ports: + - 5000:5000 steps: - uses: actions/checkout@v2 with: @@ -123,11 +128,28 @@ jobs: - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 - - name: build base image for aarch64 + - name: build slim image + working-directory: image/base + run: | + docker buildx build . --load \ + -f slim.Dockerfile \ + --platform linux/arm64 \ + --tag discourse/base:aarch64-slim + docker tag discourse/base:aarch64-slim localhost:5000/discourse/base:aarch64-slim + docker push localhost:5000/discourse/base:aarch64-slim + - name: build release image + working-directory: image/base run: | - cd image/base - docker buildx build . -f slim.Dockerfile --platform linux/arm64 --load --tag discourse/base:aarch64-slim - docker buildx build . -f release.Dockerfile --platform linux/arm64 --load --tag discourse/base:aarch64 --build-arg tag=aarch64-slim + docker buildx create --name builder --use --driver-opt network=host + docker buildx build . --load \ + -f release.Dockerfile \ + --platform linux/arm64 \ + --network=host \ + --build-arg from=localhost:5000/discourse/base \ + --build-arg tag=aarch64-slim \ + --tag discourse/base:aarch64 + - name: Print summary + run: docker images discourse/base - name: push to dockerhub if: success() && (github.ref == 'refs/heads/main') env: diff --git a/image/base/release.Dockerfile b/image/base/release.Dockerfile index c087bde..49ec625 100644 --- a/image/base/release.Dockerfile +++ b/image/base/release.Dockerfile @@ -1,6 +1,7 @@ +ARG from=discourse/base ARG tag=build_slim -FROM discourse/base:$tag +FROM $from:$tag RUN cd /var/www/discourse &&\ sudo -u discourse bundle install --deployment --jobs 4 --without test development &&\ -- 2.25.1