Skip to content

Commit

Permalink
🔀 Merge pull request gchq#162 from Lissy93/DOCKER/multi-arch-automate…
Browse files Browse the repository at this point in the history
…d-builds

[DOCKER] Action to build multi-architecture containers
Re: gchq#158
  • Loading branch information
Lissy93 authored Aug 15, 2021
2 parents 2c0fe0e + a690134 commit dabb72d
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,42 @@ env:
jobs:
build-and-push-image:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
permissions:
contents: read
packages: write
steps:
# Fetch the code
- name: Checkout repository
uses: actions/checkout@v2
# Build the image from default Dockerfile
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

- name: Prepare
id: prep
run: echo ::set-output name=version::${GITHUB_REF##*/}

# Use QEMU for multi-architecture builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

# Use Moby BuildKit
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master

# Login into GH container registry
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

# Build the image from default Dockerfile
- name: Build image
run: docker build . --file docker/Dockerfile-multi-arch --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"

# Push build image
- name: Push image
run: |
Expand Down

0 comments on commit dabb72d

Please sign in to comment.