Skip to content

Commit

Permalink
chore(workflows): update Docker build action to v5 and add caching
Browse files Browse the repository at this point in the history
Updated the Docker build action to version 5 for improved functionality and added caching support for better performance. The cosign signing process now includes the image digest dynamically retrieved from the build step output.
  • Loading branch information
obeone committed Mar 7, 2024
1 parent 9391e6b commit b6e5b27
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,26 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to GHCR and Docker Hub
uses: docker/build-push-action@v2
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/obeone/crawler-to-md:latest
docker.io/obeoneorg/crawler-to-md:latest
platforms: linux/amd64,linux/arm64,linux/i386,linux/armhf,linux/armel

- name: Set up cosign
uses: sigstore/cosign-installer@main
with:
cosign-release: 'v1.5.2'

- name: Sign the container image with cosign
run: |
cosign sign ghcr.io/obeone/crawler-to-md:latest
cosign sign docker.io/obeoneorg/crawler-to-md:latest
cosign sign --yes ghcr.io/obeone/crawler-to-md@${DIGEST}
cosign sign --yes docker.io/obeoneorg/crawler-to-md@${DIGEST}
env:
COSIGN_EXPERIMENTAL: true
DIGEST: ${{ steps.build-and-push.outputs.digest }}

0 comments on commit b6e5b27

Please sign in to comment.