Skip to content

Commit

Permalink
Merge pull request #785 from orvice/feat/docker-build-mutil-arch
Browse files Browse the repository at this point in the history
update docker action
  • Loading branch information
orvice authored Aug 26, 2022
2 parents 8fa4435 + e12e6a0 commit 421c858
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Docker

on:
schedule:
- cron: '39 21 * * *'
- cron: '39 16 * * *'
push:
branches: [ "master" ]
# Publish semver tags as releases.
Expand Down Expand Up @@ -41,14 +41,19 @@ jobs:
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
uses: sigstore/cosign-installer@7e0881f8fe90b25e305bbf0309761e9314607e25
with:
cosign-release: 'v1.7.1'
cosign-release: 'v1.9.0'

- name: Set up QEMU
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@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
Expand All @@ -72,10 +77,23 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# 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 }}

0 comments on commit 421c858

Please sign in to comment.