Skip to content

Commit e2c2927

Browse files
chore(ci): enable reproducible Docker builds with provenance and SLSA attestations (#207)
1 parent c33c52c commit e2c2927

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

infrastructure/ci/docker-build-pipeline.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
- name: Checkout code
2121
uses: actions/checkout@v4
2222

23+
- name: Set source date epoch
24+
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
2325
- name: Set up Docker Buildx
2426
uses: docker/setup-buildx-action@v3
2527

@@ -37,6 +39,10 @@ jobs:
3739
push: false
3840
cache-from: type=gha
3941
cache-to: type=gha,mode=max
42+
provenance: mode=max
43+
sbom: true
44+
attestations: true
45+
build-args: SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
4046
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:build-${{ github.sha }}
4147

4248
test:
@@ -59,6 +65,10 @@ jobs:
5965
target: test
6066
push: false
6167
cache-from: type=gha
68+
provenance: mode=max
69+
sbom: true
70+
attestations: true
71+
build-args: SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
6272
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:test-${{ github.sha }}
6373

6474
security-scan:
@@ -70,6 +80,9 @@ jobs:
7080
- name: Checkout code
7181
uses: actions/checkout@v4
7282

83+
- name: Set source date epoch
84+
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
85+
7386
- name: Set up Docker Buildx
7487
uses: docker/setup-buildx-action@v3
7588

@@ -82,6 +95,10 @@ jobs:
8295
push: false
8396
load: true
8497
cache-from: type=gha
98+
provenance: mode=max
99+
sbom: true
100+
attestations: true
101+
build-args: SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
85102
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:scan-${{ github.sha }}
86103

87104
- name: Run Trivy vulnerability scan
@@ -106,6 +123,9 @@ jobs:
106123
- name: Checkout code
107124
uses: actions/checkout@v4
108125

126+
- name: Set source date epoch
127+
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
128+
109129
- name: Set up Docker Buildx
110130
uses: docker/setup-buildx-action@v3
111131

@@ -135,6 +155,10 @@ jobs:
135155
push: true
136156
cache-from: type=gha
137157
cache-to: type=gha,mode=max
158+
provenance: mode=max
159+
sbom: true
160+
attestations: true
161+
build-args: SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
138162
tags: ${{ steps.meta.outputs.tags }}
139163
labels: ${{ steps.meta.outputs.labels }}
140164

0 commit comments

Comments
 (0)