Create images #848
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create images | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
schedule: | |
# every day | |
- cron: '10 0 * * *' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
distro: [alma8, alma9-clang, debian125, fedora39, fedora40, fedora41, ubuntu20, ubuntu22, ubuntu2404, ubuntu2404-cuda, ubuntu2410] | |
platform: [linux/amd64] | |
include: | |
- distro: alma9 | |
platform: linux/amd64,linux/arm64 | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free disk space | |
run: | | |
sudo rm -rf /usr/share/dotnet || true | |
sudo rm -rf /usr/local/lib/android || true | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Build multi-arch container. | |
# We do this using emulation to have both architectures in the same container, | |
# And also because our "real" arm runners are using podman, which doesn't support | |
# "docker buildx" that is used below. | |
- name: Set up QEMU | |
if: matrix.platform != 'linux/amd64' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: ${{ matrix.platform }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: registry.cern.ch | |
username: robot-root-ci+github | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: ${{ matrix.platform }} | |
context: ./${{ matrix.distro }}/ | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: registry.cern.ch/root-ci/${{ matrix.distro }}${{ matrix.arch}}:buildready | |
labels: org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
no-cache: ${{ github.event_name != 'push' && github.event_name != 'pull_request' }} | |
cache-from: type=gha,scope=${{ matrix.distro }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.distro }} |