88 - image/Dockerfile-base
99 - .github/workflows/base-image.yaml
1010 schedule :
11- - cron : 0 1 * * 1
11+ - cron : 0 1 1 * *
1212
1313permissions :
1414 contents : read
@@ -17,31 +17,53 @@ jobs:
1717 push_image :
1818 runs-on : ubuntu-24.04
1919 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 }}
2226 steps :
2327 - name : Checkout
2428 uses : actions/checkout@v4
2529 with :
2630 persist-credentials : false
2731
2832 - name : Registry login
33+ env :
34+ DOCKER_TOKEN : ${{ secrets.DOCKER_TOKEN }}
2935 run : |
3036 echo $DOCKER_TOKEN | docker login --username danielflook --password-stdin
3137
3238 - name : Set up Docker Buildx
3339 uses : docker/setup-buildx-action@v2
3440
3541 - name : Base image
42+ id : build-and-push
3643 run : |
3744 docker buildx build \
3845 --tag danielflook/terraform-github-actions-base:$GITHUB_RUN_ID \
3946 --tag danielflook/terraform-github-actions-base:latest \
4047 --platform linux/amd64,linux/arm64 \
4148 --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" \
4258 --file image/Dockerfile-base \
4359 --push \
4460 --iidfile manifest-list-digest.txt \
4561 image
4662
4763 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