github-actions: build docker platforms together (#3426)

* github-actions: build docker platforms together

* only on main
This commit is contained in:
Caleb Doxsey 2022-06-14 18:04:44 -06:00 committed by GitHub
parent db426072b0
commit 507dbbdcf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,6 @@ on:
push:
branches:
- main
pull_request:
jobs:
publish:
@ -13,7 +12,6 @@ jobs:
matrix:
platform: [ubuntu-latest]
dockerfile: [Dockerfile, Dockerfile.debug]
dockerplatform: [linux/amd64, linux/arm64]
runs-on: ${{ matrix.platform }}
@ -52,7 +50,7 @@ jobs:
TAGS=${TAGS},${IMAGE}:${SHA_TAG}
fi
TS=$(date +%Y%m%d%H%M%S)
BUILDCACHE_TAG=buildcache-$(echo -n "$DOCKERFILE-$DOCKERPLATFORM" | sha1sum | awk '{print $1}')
BUILDCACHE_TAG=buildcache-$(echo -n "$DOCKERFILE" | sha1sum | awk '{print $1}')
echo ::set-output name=tags::${TAGS}
echo ::set-output name=timestamp::${TS}
echo ::set-output name=name::pomerium
@ -61,7 +59,6 @@ jobs:
echo ::set-output name=buildcache-tag::${BUILDCACHE_TAG}
env:
DOCKERFILE: ${{ matrix.dockerfile }}
DOCKERPLATFORM: ${{ matrix.dockerplatform }}
- name: Docker Publish
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8
@ -69,7 +66,7 @@ jobs:
context: .
file: ${{ matrix.dockerfile }}
push: ${{ github.ref == 'refs/heads/main' }}
platforms: ${{ matrix.dockerplatform }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.metadata.outputs.tags }}
labels: |
org.opencontainers.image.created=${{ steps.metadata.outputs.timestamp }}