Build Docker CI Images #10
This file contains hidden or 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: "Build Docker CI Images" | |
| on: | |
| workflow_dispatch | |
| jobs: | |
| build-images: | |
| name: "Build ${{ matrix.image }} (${{ matrix.platform }})" | |
| runs-on: ${{ matrix.platform == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: amd64 | |
| image: rpm-repo-builder | |
| dockerfile: packaging/rpm/docker/rpm-repo-builder/Dockerfile | |
| - platform: arm64 | |
| image: rpm-repo-builder | |
| dockerfile: packaging/rpm/docker/rpm-repo-builder/Dockerfile | |
| - platform: amd64 | |
| image: ice-rpm-builder-el9 | |
| dockerfile: packaging/rpm/docker/el9/Dockerfile | |
| - platform: arm64 | |
| image: ice-rpm-builder-el9 | |
| dockerfile: packaging/rpm/docker/el9/Dockerfile | |
| - platform: amd64 | |
| image: ice-rpm-builder-el10 | |
| dockerfile: packaging/rpm/docker/el10/Dockerfile | |
| - platform: arm64 | |
| image: ice-rpm-builder-el10 | |
| dockerfile: packaging/rpm/docker/el10/Dockerfile | |
| - platform: amd64 | |
| image: ice-rpm-builder-amzn2023 | |
| dockerfile: packaging/rpm/docker/amzn2023/Dockerfile | |
| - platform: arm64 | |
| image: ice-rpm-builder-amzn2023 | |
| dockerfile: packaging/rpm/docker/amzn2023/Dockerfile | |
| - platform: amd64 | |
| image: ice-deb-builder-debian12 | |
| dockerfile: packaging/dpkg/docker/debian12/Dockerfile | |
| - platform: arm64 | |
| image: ice-deb-builder-debian12 | |
| dockerfile: packaging/dpkg/docker/debian12/Dockerfile | |
| - platform: amd64 | |
| image: ice-deb-builder-ubuntu24.04 | |
| dockerfile: packaging/dpkg/docker/ubuntu24.04/Dockerfile | |
| - platform: arm64 | |
| image: ice-deb-builder-ubuntu24.04 | |
| dockerfile: packaging/dpkg/docker/ubuntu24.04/Dockerfile | |
| env: | |
| # On Red Hat-based images, we need to provide credentials to access the Red Hat repositories. | |
| USE_RH_CREDENTIALS: ${{ startsWith(matrix.image, 'ice-rpm-builder-el') && 'true' || 'false' }} | |
| # Disable attestations for compatibility with ghcr.io registry. | |
| # See: https://github.com/orgs/community/discussions/45969 | |
| BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ice | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: zeroc-ice | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Add RH credentials | |
| if: env.USE_RH_CREDENTIALS == 'true' | |
| run: | | |
| umask 077 | |
| echo "RH_USERNAME=\"${{ secrets.RH_USERNAME }}\"" >> rh_credentials | |
| echo "RH_PASSWORD=\"${{ secrets.RH_PASSWORD }}\"" >> rh_credentials | |
| - name: Build and push image | |
| run: | | |
| args=( | |
| --platform "linux/${{ matrix.platform }}" | |
| --tag "ghcr.io/zeroc-ice/${{ matrix.image }}:${{ matrix.platform }}" | |
| --push | |
| -f ${{ matrix.dockerfile }} | |
| ) | |
| # Add secret with Red Hat credentials if needed | |
| if [[ "$USE_RH_CREDENTIALS" == "true" ]]; then | |
| args+=( --secret id=rh_credentials,src=../rh_credentials ) | |
| fi | |
| docker buildx build "${args[@]}" . | |
| working-directory: ice | |
| - name: Clean up RH credentials | |
| if: always() && env.USE_RH_CREDENTIALS == 'true' | |
| run: rm -f rh_credentials | |
| create-manifests: | |
| name: "Create and Push Multi-Arch Manifests" | |
| runs-on: ubuntu-24.04 | |
| needs: build-images | |
| strategy: | |
| matrix: | |
| image: | |
| - rpm-repo-builder | |
| - ice-rpm-builder-el9 | |
| - ice-rpm-builder-el10 | |
| - ice-rpm-builder-amzn2023 | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: zeroc-ice | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push manifest | |
| run: | | |
| docker manifest create ghcr.io/zeroc-ice/${{ matrix.image }}:latest \ | |
| --amend ghcr.io/zeroc-ice/${{ matrix.image }}:amd64 \ | |
| --amend ghcr.io/zeroc-ice/${{ matrix.image }}:arm64 | |
| docker manifest push ghcr.io/zeroc-ice/${{ matrix.image }}:latest |