|
| 1 | +name: Build CI Container Images |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - ".github/workflows/container_images.yml" |
| 8 | + - "container/**" |
| 9 | + push: |
| 10 | + paths: |
| 11 | + - ".github/workflows/container_images.yml" |
| 12 | + - "container/**" |
| 13 | +env: |
| 14 | + REGISTRY: ghcr.io |
| 15 | +jobs: |
| 16 | + build-images: |
| 17 | + name: ${{ matrix.variance.name }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + packages: write |
| 22 | + attestations: write |
| 23 | + id-token: write |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + variance: |
| 28 | + - name: Ubuntu-22.04/CUDA-11.8.0 |
| 29 | + image: "${{ github.repository }}-ubuntu22-cuda11" |
| 30 | + dockerfile: ./container/ubuntu22-cuda11/Dockerfile |
| 31 | + - name: Ubuntu-22.04/CUDA-12.8.1 |
| 32 | + image: "${{ github.repository }}-ubuntu22-cuda12" |
| 33 | + dockerfile: ./container/ubuntu22-cuda12/Dockerfile |
| 34 | + - name: Ubuntu-24.04/CUDA-12.8.1 |
| 35 | + image: "${{ github.repository }}-ubuntu24-cuda12" |
| 36 | + dockerfile: ./container/ubuntu24-cuda12/Dockerfile |
| 37 | + - name: RockyLinux-9/CUDA-12.8.1 |
| 38 | + image: "${{ github.repository }}-rockylinux9-cuda12" |
| 39 | + dockerfile: ./container/rockylinux9-cuda12/Dockerfile |
| 40 | + steps: |
| 41 | + - name: Checkout repository |
| 42 | + uses: actions/checkout@v4 |
| 43 | + - name: Log in to the Container registry |
| 44 | + uses: docker/login-action@v3 |
| 45 | + with: |
| 46 | + registry: ${{ env.REGISTRY }} |
| 47 | + username: ${{ github.actor }} |
| 48 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + - name: Extract metadata (tags, labels) for containers |
| 50 | + id: meta |
| 51 | + uses: docker/metadata-action@v5 |
| 52 | + with: |
| 53 | + images: ${{ env.REGISTRY }}/${{ matrix.variance.image }} |
| 54 | + tags: | |
| 55 | + type=ref,event=branch |
| 56 | + type=sha,format=short |
| 57 | + type=raw,value=latest |
| 58 | + - name: Set up Docker Buildx |
| 59 | + uses: docker/setup-buildx-action@v3 |
| 60 | + - name: Build and push container images |
| 61 | + id: push |
| 62 | + uses: docker/build-push-action@v6 |
| 63 | + with: |
| 64 | + context: . |
| 65 | + file: ${{ matrix.variance.dockerfile }} |
| 66 | + tags: ${{ steps.meta.outputs.tags }} |
| 67 | + labels: ${{ steps.meta.outputs.labels }} |
| 68 | + push: ${{ github.event_name != 'pull_request' }} |
| 69 | + - name: Generate artifact attestation |
| 70 | + uses: actions/attest-build-provenance@v2 |
| 71 | + with: |
| 72 | + subject-name: ${{ env.REGISTRY }}/${{ matrix.variance.image }} |
| 73 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 74 | + push-to-registry: true |
0 commit comments