File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and push Docker image
2+
3+ on :
4+ push :
5+ branches : ['feature/github-actions-docker-build']
6+
7+ env :
8+ REGISTRY : ghcr.io
9+ IMAGE_NAME : ${{ github.repository }}
10+
11+ jobs :
12+ build-and-push-image :
13+ runs-on : ubuntu-latest
14+ permissions :
15+ contents : read
16+ packages : write
17+ attestations : write
18+ id-token : write
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@v4
22+
23+ - name : Log in to the Container registry
24+ uses : docker/login-action@v3.4.0
25+ with :
26+ registry : ${{ env.REGISTRY }}
27+ username : ${{ github.actor }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Extract metadata (tags, labels) for Docker
31+ id : meta
32+ uses : docker/metadata-action@v5.7.0
33+ with :
34+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
35+
36+ - name : Build and push Docker image
37+ id : push
38+ uses : docker/build-push-action@v6.16.0
39+ with :
40+ context : .
41+ push : false
42+ tags : ${{ steps.meta.outputs.tags }}
43+ labels : ${{ steps.meta.outputs.labels }}
44+
45+ - name : Generate artifact attestation
46+ uses : actions/attest-build-provenance@v2
47+ with :
48+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
49+ subject-digest : ${{ steps.push.outputs.digest }}
50+ push-to-registry : false
You can’t perform that action at this time.
0 commit comments