Skip to content

Commit

Permalink
Docker image signing (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasleplus authored Mar 20, 2024
1 parent 7031cdc commit 1163987
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
with:
fetch-depth: 0
fetch-tags: true
- name: Install cosign
if: github.ref == 'refs/heads/main'
uses: sigstore/cosign-installer@v3
with:
cosign-release: 'v2.1.1'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
Expand Down Expand Up @@ -49,6 +54,16 @@ jobs:
sbom: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Sign the published Docker image
if: ${{ github.ref == 'refs/heads/main' }}
env:
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: \echo "${TAGS}" | \xargs -I {} cosign sign --yes {}@${DIGEST} \
-a "workflow=${{ github.workflow }}" \
-a "repo=${{ github.repository }}" \
-a "branch=${{ github.ref_name }}" \
-a "ref=${{ github.sha }}"
- name: Test the Docker image
working-directory: ${{ env.IMAGE }}
run: docker compose -f docker-compose.test.yml run sut
Expand Down

0 comments on commit 1163987

Please sign in to comment.