Skip to content

Build images

Build images #551

name: Build images
on:
schedule:
- cron: "15 0 * * *"
workflow_dispatch:
jobs:
build-container:
permissions:
attestations: write
contents: read
id-token: write
packages: write
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["11", "12", "13"]
env:
LABEL: ghcr.io/${{ github.repository }}-python3${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Remove unnecessary files
run: |
df . -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df . -h
- name: Login to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
build-args: |
python_minor_version=${{ matrix.python-version }}
ENV_FILE=containers/environment.yml
push: true
file: containers/Dockerfile
tags: ${{ env.LABEL }}:latest
cache-from: type=registry,ref=${{ env.LABEL }}:buildcache
cache-to: type=registry,ref=${{ env.LABEL }}:buildcache,mode=max
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-name: ${{ env.LABEL }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true