From 5f1c964eb255469e80499c93c22517ab9e58a860 Mon Sep 17 00:00:00 2001 From: reivilibre <38398653+reivilibre@users.noreply.github.com> Date: Tue, 10 Aug 2021 14:29:22 +0100 Subject: [PATCH] Add a GitHub Action CI check to ensure Dockerfile changes actually work (#248) --- .github/workflows/docker_check.yml | 48 ++++++++++++++++++++++++++++++ changelog.d/248.docker | 1 + 2 files changed, 49 insertions(+) create mode 100644 .github/workflows/docker_check.yml create mode 100644 changelog.d/248.docker diff --git a/.github/workflows/docker_check.yml b/.github/workflows/docker_check.yml new file mode 100644 index 00000000..af04002a --- /dev/null +++ b/.github/workflows/docker_check.yml @@ -0,0 +1,48 @@ +# GitHub actions workflow which builds the docker images. +# This is useful as it will run in PRs that change the Dockerfile, and can be +# an early source of warnings that the Dockerfile isn't right. +# This check also triggers when this file itself is modified. + +name: Check Docker image can be built successfully + +on: + push: + paths: + - 'docker/Dockerfile' + - '.github/workflows/docker_check.yml' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + with: + platforms: arm64 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Inspect builder + run: docker buildx inspect + + # we explicitly check out the repository (and use `context: .` in buildx) + # because we need to preserve the git metadata so that setuptools_scm + # (as part of Sygnal's setup.py) can deduce the package version. + # See: https://github.com/marketplace/actions/build-and-push-docker-images#path-context + - name: Checkout + uses: actions/checkout@v2 + + - name: Build all platforms + uses: docker/build-push-action@v2 + with: + context: . + push: false + labels: "gitsha1=${{ github.sha }}" + file: "docker/Dockerfile" + platforms: linux/amd64,linux/arm64 diff --git a/changelog.d/248.docker b/changelog.d/248.docker new file mode 100644 index 00000000..aaa23983 --- /dev/null +++ b/changelog.d/248.docker @@ -0,0 +1 @@ +CI now checks that the Docker image still builds after the Dockerfile is modified.