Skip to content

docker

docker #29

Workflow file for this run

name: docker
on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
workflow_dispatch:
env:
# Possibly change this to `hub.docker.com` in the future
REGISTRY: ghcr.io
REPO_NAME: ${{ github.repository }}
jobs:
build-and-push-docker-images:
if: github.repository == 'leanprover-community/mathlib4'
strategy:
fail-fast: false
matrix:
image:
- gitpod
- gitpod-blueprint
- lean
name: Build and push docker image '${{ matrix.image }}'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
# documentation at
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Log in to the container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
# might need set as `secrets.DOCKER_USERNAME` and `secrets.DOCKER_PASSWORD`
# if using different registry than ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for docker
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ matrix.image }}
tags: |
type=schedule,pattern={{date 'YYYY-MM-DD'}}
type=sha
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest
labels: |
org.opencontainers.image.licenses=Apache-2.0
- name: Build and push docker image
id: push
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: .docker/${{ matrix.image }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ matrix.image }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true