Skip to content

Commit

Permalink
Build Docker images for various platforms in a matrix strategy
Browse files Browse the repository at this point in the history
This makes it easier to temporarily drop support for a failing platform
that we cannot fix, as we are currently experiencing  with
#64.

Co-authored-by: Nick M <[email protected]>
  • Loading branch information
jsf9k and mcdonnnj committed Jul 25, 2021
1 parent c6aa7f0 commit e814cd6
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ env:
CURL_CACHE_DIR: ~/.cache/curl
IMAGE_NAME: cisagov/example
PIP_CACHE_DIR: ~/.cache/pip
PLATFORMS: "linux/amd64,linux/arm/v6,linux/arm/v7,\
linux/arm64,linux/ppc64le,linux/s390x"
PRE_COMMIT_CACHE_DIR: ~/.cache/pre-commit
RUN_TMATE: ${{ secrets.RUN_TMATE }}

Expand Down Expand Up @@ -347,15 +345,24 @@ jobs:
uses: mxschmitt/action-tmate@v3
if: env.RUN_TMATE
build-push-all:
# Builds the final set of images for each of the platforms listed in
# PLATFORMS environment variable. These images are tagged with the Docker
# tags calculated in the "prepare" job and pushed to Docker Hub and the
# GitHub Container Registry. The contents of README.md are pushed as the
# Builds the final set of images for each of the platforms listed
# below. These images are tagged with the Docker tags calculated
# in the "prepare" job and pushed to Docker Hub and the GitHub
# Container Registry. The contents of README.md are pushed as the
# image's description to Docker Hub. This job is skipped when the
# triggering event is a pull request.
name: "Build and push all platforms"
runs-on: ubuntu-latest
needs: [lint, prepare, test]
strategy:
matrix:
platform:
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/ppc64le
- linux/s390x
if: github.event_name != 'pull_request'
steps:
- name: Login to Docker Hub
Expand Down Expand Up @@ -396,7 +403,7 @@ jobs:
cache-to: type=local,dest=${{ env.BUILDX_CACHE_DIR }}
context: .
file: ./Dockerfile-x
platforms: ${{ env.PLATFORMS }}
platforms: ${{ matrix.platform }}
push: true
tags: ${{ needs.prepare.outputs.tags }}
# For a list of pre-defined annotation keys and value types see:
Expand Down

0 comments on commit e814cd6

Please sign in to comment.