8
8
- image/Dockerfile-base
9
9
- .github/workflows/base-image.yaml
10
10
schedule :
11
- - cron : 0 1 * * 1
11
+ - cron : 0 1 1 * *
12
12
13
13
permissions :
14
14
contents : read
@@ -17,31 +17,53 @@ jobs:
17
17
push_image :
18
18
runs-on : ubuntu-24.04
19
19
name : Docker Images
20
- env :
21
- DOCKER_TOKEN : ${{ secrets.DOCKER_TOKEN }}
20
+ permissions :
21
+ id-token : write
22
+ attestations : write
23
+ environment :
24
+ name : dockerhub
25
+ url : https://hub.docker.com/r/danielflook/terraform-github-actions-base/tags?name=${{ github.run_id }}
22
26
steps :
23
27
- name : Checkout
24
28
uses : actions/checkout@v4
25
29
with :
26
30
persist-credentials : false
27
31
28
32
- name : Registry login
33
+ env :
34
+ DOCKER_TOKEN : ${{ secrets.DOCKER_TOKEN }}
29
35
run : |
30
36
echo $DOCKER_TOKEN | docker login --username danielflook --password-stdin
31
37
32
38
- name : Set up Docker Buildx
33
39
uses : docker/setup-buildx-action@v2
34
40
35
41
- name : Base image
42
+ id : build-and-push
36
43
run : |
37
44
docker buildx build \
38
45
--tag danielflook/terraform-github-actions-base:$GITHUB_RUN_ID \
39
46
--tag danielflook/terraform-github-actions-base:latest \
40
47
--platform linux/amd64,linux/arm64 \
41
48
--attest type=provenance,mode=max,builder-id=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID \
49
+ --annotation "index,manifest:org.opencontainers.image.created=$(date '+%Y-%m-%dT%H:%M:%S%z')" \
50
+ --annotation "index,manifest:org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
51
+ --annotation "index,manifest:org.opencontainers.image.revision=${{ github.sha }}" \
52
+ --annotation "index,manifest:org.opencontainers.image.title=terraform-github-actions-base" \
53
+ --annotation "index,manifest:org.opencontainers.image.description=Base image for terraform-github-actions" \
54
+ --annotation "index:org.opencontainers.image.ref.name=docker.io/danielflook/terraform-github-actions-base:$GITHUB_RUN_ID" \
55
+ --annotation "index,manifest:builder-id=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
56
+ --annotation "index,manifest:ref.tag=$GITHUB_RUN_ID" \
57
+ --annotation "index,manifest:org.opencontainers.image.base.name=docker.io/debian:bullseye-slim" \
42
58
--file image/Dockerfile-base \
43
59
--push \
44
60
--iidfile manifest-list-digest.txt \
45
61
image
46
62
47
63
echo "digest=$(<manifest-list-digest.txt)" >> "$GITHUB_OUTPUT"
64
+
65
+ - name : Generate image attestation
66
+ uses : actions/attest-build-provenance@v2
67
+ with :
68
+ subject-name : index.docker.io/danielflook/terraform-github-actions-base
69
+ subject-digest : ${{ steps.build-and-push.outputs.digest }}
0 commit comments