Skip to content

Commit 4709cb9

Browse files
committed
fix slsa provenance
1 parent 8fb5782 commit 4709cb9

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

.github/workflows/docker-image-release.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ on:
88
permissions:
99
id-token: write
1010
contents: read
11+
packages: write
1112

1213
jobs:
13-
build:
14+
build-images:
1415
strategy:
1516
matrix:
1617
arch: [amd64, arm64]
@@ -42,20 +43,23 @@ jobs:
4243
with:
4344
install: true
4445

45-
- name: Build and push image with provenance for ${{ matrix.arch }}
46+
- name: Build and push image for ${{ matrix.arch }}
4647
uses: docker/build-push-action@v6
4748
with:
4849
context: .
4950
platforms: linux/${{ matrix.arch }}
5051
tags: fontebasso/php-nginx:${{ steps.version.outputs.tag }}-${{ matrix.arch }}
5152
push: true
52-
provenance: true
53+
provenance: false
5354
build-args: |
5455
VERSION=${{ steps.version.outputs.tag }}
5556
56-
merge:
57-
needs: build
57+
merge-multiarch:
58+
name: Merge Multi-Arch Image and Sign
59+
needs: build-images
5860
runs-on: ubuntu-latest
61+
outputs:
62+
digest: ${{ steps.push.outputs.digest }}
5963
steps:
6064
- name: Extract release version
6165
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
@@ -66,29 +70,37 @@ jobs:
6670
username: ${{ secrets.DOCKERHUB_USERNAME }}
6771
password: ${{ secrets.DOCKERHUB_TOKEN }}
6872

69-
- name: Merge multi-arch image
73+
- name: Merge multi-arch image and get digest
74+
id: push
7075
run: |
7176
docker buildx imagetools create \
7277
--tag fontebasso/php-nginx:${RELEASE_VERSION} \
7378
--tag fontebasso/php-nginx:latest \
7479
fontebasso/php-nginx:${RELEASE_VERSION}-amd64 \
7580
fontebasso/php-nginx:${RELEASE_VERSION}-arm64
7681
82+
digest=$(docker buildx imagetools inspect fontebasso/php-nginx:${RELEASE_VERSION} --format '{{.Digest}}')
83+
echo "digest=$digest"
84+
echo "digest=$digest" >> "$GITHUB_OUTPUT"
85+
7786
- name: Install Cosign
7887
uses: sigstore/[email protected]
7988

80-
- name: Sign image using GitHub OIDC
89+
- name: Sign image by digest (OIDC keyless)
8190
env:
8291
COSIGN_EXPERIMENTAL: "1"
8392
run: |
84-
cosign sign --yes docker.io/fontebasso/php-nginx:${RELEASE_VERSION}
85-
cosign sign --yes docker.io/fontebasso/php-nginx:latest
93+
cosign sign --yes docker.io/fontebasso/php-nginx@${{ steps.push.outputs.digest }}
8694
87-
- name: Generate and attach SLSA Provenance
88-
run: |
89-
cosign attest --yes \
90-
--type=provenance \
91-
docker.io/fontebasso/php-nginx:${RELEASE_VERSION}
92-
cosign attest --yes \
93-
--type=provenance \
94-
docker.io/fontebasso/php-nginx:latest
95+
generate-provenance:
96+
name: Generate SLSA Provenance v1.1
97+
needs: merge-multiarch
98+
if: startsWith(github.ref, 'refs/tags/')
99+
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
100+
with:
101+
image: docker.io/fontebasso/php-nginx
102+
digest: ${{ needs.merge-multiarch.outputs.digest }}
103+
permissions:
104+
id-token: write
105+
contents: read
106+
packages: write

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Docker Build](https://github.com/fontebasso/docker-php-nginx/workflows/docker/badge.svg)](https://github.com/fontebasso/docker-php-nginx/actions?query=workflow%3Adocker)
44
[![Docker Pulls](https://img.shields.io/docker/pulls/fontebasso/php-nginx)](https://hub.docker.com/r/fontebasso/php-nginx)
55
[![Signed with Sigstore](https://img.shields.io/badge/sigstore-signed-blue?logo=sigstore)](https://www.sigstore.dev)
6-
[![Provenance Verified](https://img.shields.io/badge/provenance-SLSA%20v1.0-brightgreen)](https://github.com/sigstore/cosign)
6+
[![SLSA Provenance](https://img.shields.io/badge/provenance-SLSA%20v1.1-brightgreen)](https://slsa.dev/spec/v1.1)
77
[![GitHub License](https://img.shields.io/github/license/fontebasso/docker-php-nginx)](https://github.com/fontebasso/docker-php-nginx/blob/main/LICENSE)
88

99
This repository contains a Docker image for running high-performance PHP web applications. It is optimized for speed, efficiency, and includes a comprehensive set of tools and libraries commonly used in web development.
@@ -16,7 +16,7 @@ This repository contains a Docker image for running high-performance PHP web app
1616
This image is:
1717

1818
- ✅ Signed with [Sigstore Cosign](https://docs.sigstore.dev)
19-
- ✅ Provenance generated in the [SLSA v1.0](https://slsa.dev/spec/v1.0/provenance)
19+
- ✅ Provenance generated in the [SLSA v1.1](https://slsa.dev/spec/v1.1/provenance)
2020
- ✅ Compatible with verification using `cosign verify` and `cosign verify-attestation`
2121

2222
To verify the image and its provenance (example):

0 commit comments

Comments
 (0)