Skip to content

Put metadata in annotations #227

Put metadata in annotations

Put metadata in annotations #227

Workflow file for this run

name: Update base image
on:
push:
# branches:
# - main
# paths:
# - image/Dockerfile-base
# - .github/workflows/base-image.yaml
schedule:
- cron: 0 1 * * 1
permissions:
contents: read
jobs:
push_image:
runs-on: ubuntu-24.04
name: Docker Images
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Registry login
run: |
echo $DOCKER_TOKEN | docker login --username danielflook --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Base image
run: |
docker buildx build \
--tag danielflook/terraform-github-actions-base:$GITHUB_RUN_ID \
--tag danielflook/terraform-github-actions-base:latest \
--platform linux/amd64,linux/arm64 \
--attest type=provenance,mode=max,builder-id=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID \
--annotation "index,manifest:org.opencontainers.image.created=$(date '+%Y-%m-%dT%H:%M:%S%z')" \
--annotation "index,manifest:org.opencontainers.image.source=https://github.com/${{ github.repository }}" \
--annotation "index,manifest:org.opencontainers.image.revision=${{ github.sha }}" \
--annotation "index,manifest:org.opencontainers.image.title=terraform-github-actions-base" \
--annotation "index,manifest:org.opencontainers.image.description=Base image for terraform-github-actions" \
--annotation "index:org.opencontainers.image.ref.name=docker.io/danielflook/terraform-github-actions-base:$GITHUB_RUN_ID" \
--annotation "index,manifest:builder-id=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \
--annotation "index,manifest:ref.tag=$GITHUB_RUN_ID" \
--annotation "index,manifest:org.opencontainers.image.base.name=docker.io/debian:bullseye-slim" \
--file image/Dockerfile-base \
--push \
--iidfile manifest-list-digest.txt \
image
echo "digest=$(<manifest-list-digest.txt)" >> "$GITHUB_OUTPUT"