From 0af1c01f1b7e3b1cdfadf33925733c733f8a8446 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Thu, 3 Mar 2022 09:38:09 -0500 Subject: [PATCH] Add support to build multi-arch docker images (#1587) --- .github/workflows/dev_deploy.yml | 39 ++++++++++++++++++++++++++------ .github/workflows/publish.yml | 35 ++++++++++++++++++++++++---- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 198640a..c63614a 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -12,14 +12,41 @@ jobs: - name: Check out the repo uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: | + slatedocs/slate + tags: | + type=ref,event=branch + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_KEY }} - repository: slatedocs/slate - tag_with_ref: true - + + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/ppc64le + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + deploy_gh: permissions: contents: write @@ -42,13 +69,11 @@ jobs: restore-keys: | gems-${{ runner.os }}-${{ env.ruby-version }}- gems-${{ runner.os }}- - - run: bundle config set deployment 'true' - name: bundle install run: | bundle config path vendor/bundle bundle install --jobs 4 --retry 3 - - run: bundle exec middleman build - name: Deploy diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d57930a..6c51180 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,11 +12,36 @@ jobs: - name: Check out the repo uses: actions/checkout@v2 - - name: Push to Docker Hub - uses: docker/build-push-action@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: slatedocs/slate + tags: | + type=ref,event=tag + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_ACCESS_KEY }} - repository: slatedocs/slate - tag_with_ref: true - tags: latest + + - name: Push to Docker Hub + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/ppc64le + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}