|
|
|
@ -41,24 +41,32 @@ jobs:
|
|
|
|
|
# https://github.com/sigstore/cosign-installer
|
|
|
|
|
- name: Install cosign
|
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
|
uses: sigstore/cosign-installer@b3413d484cc23cf8778c3d2aa361568d4eb54679
|
|
|
|
|
uses: sigstore/cosign-installer@main
|
|
|
|
|
with:
|
|
|
|
|
cosign-release: 'v1.9.0'
|
|
|
|
|
cosign-release: 'v1.11.0' # optional
|
|
|
|
|
|
|
|
|
|
# Setup QEMU
|
|
|
|
|
# https://github.com/marketplace/actions/docker-setup-buildx#with-qemu
|
|
|
|
|
- name: Setup QEMU
|
|
|
|
|
uses: docker/setup-qemu-action@v2.0.0
|
|
|
|
|
uses: docker/setup-qemu-action@v2
|
|
|
|
|
|
|
|
|
|
# Workaround: https://github.com/docker/build-push-action/issues/461
|
|
|
|
|
- name: Setup Docker buildx
|
|
|
|
|
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6
|
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
|
|
- name: Cache Docker layers
|
|
|
|
|
uses: actions/cache@v3
|
|
|
|
|
with:
|
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
|
|
|
restore-keys: |
|
|
|
|
|
${{ runner.os }}-buildx-
|
|
|
|
|
|
|
|
|
|
# Login against a Docker registry except on PR
|
|
|
|
|
# https://github.com/docker/login-action
|
|
|
|
|
- name: Log into registry ${{ env.REGISTRY }}
|
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
|
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b
|
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
|
with:
|
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
@ -68,7 +76,7 @@ jobs:
|
|
|
|
|
# https://github.com/docker/metadata-action
|
|
|
|
|
- name: Extract Docker metadata
|
|
|
|
|
id: meta
|
|
|
|
|
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a
|
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
|
|
|
|
|
@ -76,7 +84,7 @@ jobs:
|
|
|
|
|
# https://github.com/docker/build-push-action
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
|
id: build-and-push
|
|
|
|
|
uses: docker/build-push-action@c84f38281176d4c9cdb1626ffafcd6b3911b5d94
|
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
@ -85,8 +93,8 @@ jobs:
|
|
|
|
|
# https://github.com/docker/setup-qemu-action#about
|
|
|
|
|
# platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
|
|
|
|
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
|
|
|
|
|
cache-from: type=gha
|
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
|
|
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
|
|
|
|
|
|
|
|
|
# Sign the resulting Docker image digest except on PRs.
|
|
|
|
|
# This will only write to the public Rekor transparency log when the Docker
|
|
|
|
@ -100,3 +108,11 @@ jobs:
|
|
|
|
|
# This step uses the identity token to provision an ephemeral certificate
|
|
|
|
|
# against the sigstore community Fulcio instance.
|
|
|
|
|
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
|
|
|
|
|
|
|
|
|
|
# Temp fix
|
|
|
|
|
# https://github.com/docker/build-push-action/issues/252
|
|
|
|
|
# https://github.com/moby/buildkit/issues/1896
|
|
|
|
|
- name: Move cache
|
|
|
|
|
run: |
|
|
|
|
|
rm -rf /tmp/.buildx-cache
|
|
|
|
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
|
|
|
|