Skip to content

docker

docker #196

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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Log in to the container registry
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.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@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.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@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.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@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
with:
subject-name: ${{ env.REGISTRY }}/${{ env.REPO_NAME }}/${{ matrix.image }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true