|
| 1 | +name: Build Airbender Prover Server images |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + secrets: |
| 5 | + DOCKERHUB_USER: |
| 6 | + description: "DOCKERHUB_USER" |
| 7 | + required: true |
| 8 | + DOCKERHUB_TOKEN: |
| 9 | + description: "DOCKERHUB_TOKEN" |
| 10 | + required: true |
| 11 | + inputs: |
| 12 | + image_tag_suffix: |
| 13 | + description: "Optional suffix to override tag name generation" |
| 14 | + type: string |
| 15 | + required: false |
| 16 | + action: |
| 17 | + description: "Action with docker image (build | push)" |
| 18 | + type: string |
| 19 | + default: "push" |
| 20 | + required: false |
| 21 | + |
| 22 | +# The Airbender prover server is a self-contained Cargo workspace that pulls |
| 23 | +# `eravm-prover-host` and the guest verifier crates as git dependencies, so its |
| 24 | +# Docker build context is the workspace directory (NOT the repo root) and it uses |
| 25 | +# its own CUDA base image rather than `matterlabs/zksync-build-base`. That is why |
| 26 | +# it has a dedicated template instead of riding on `build-prover-template.yml`. |
| 27 | +jobs: |
| 28 | + build-images: |
| 29 | + name: Build and Push Docker Images |
| 30 | + runs-on: [matterlabs-ci-runner-high-performance] |
| 31 | + permissions: |
| 32 | + packages: write |
| 33 | + contents: read |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + include: |
| 38 | + # GPU image: FRI prover (CUDA) + SNARK wrapper. Published under the |
| 39 | + # verifier repo's canonical image name, matching what eravm-airbender-verifier |
| 40 | + # itself pushed (`us-docker.pkg.dev/.../eravm-airbender-verifier`). |
| 41 | + - image: eravm-airbender-verifier |
| 42 | + dockerfile: docker/airbender-prover-server/Dockerfile |
| 43 | + # CPU image: snark-only pipeline, no CUDA — same name with a `-cpu` suffix. |
| 44 | + - image: eravm-airbender-verifier-cpu |
| 45 | + dockerfile: docker/airbender-prover-server/Dockerfile.cpu |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 48 | + with: |
| 49 | + submodules: "recursive" |
| 50 | + |
| 51 | + - name: Set up Docker Buildx |
| 52 | + uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 |
| 53 | + |
| 54 | + - name: Set env vars |
| 55 | + shell: bash |
| 56 | + run: | |
| 57 | + # Support for custom tag suffix; fall back to a short-sha + timestamp. |
| 58 | + if [ -n "${{ inputs.image_tag_suffix }}" ]; then |
| 59 | + echo IMAGE_TAG_SUFFIX="${{ inputs.image_tag_suffix }}" >> $GITHUB_ENV |
| 60 | + else |
| 61 | + echo IMAGE_TAG_SUFFIX="$(git rev-parse --short HEAD)-$(date +%s)" >> $GITHUB_ENV |
| 62 | + fi |
| 63 | +
|
| 64 | + - name: login to Docker registries |
| 65 | + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + docker login -u ${{ secrets.DOCKERHUB_USER }} -p ${{ secrets.DOCKERHUB_TOKEN }} |
| 69 | + gcloud auth configure-docker us-docker.pkg.dev -q |
| 70 | +
|
| 71 | + - name: Login to GitHub Container Registry |
| 72 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 |
| 73 | + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) |
| 74 | + with: |
| 75 | + registry: ghcr.io |
| 76 | + username: ${{ github.actor }} |
| 77 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + |
| 79 | + - name: Build and push |
| 80 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 |
| 81 | + with: |
| 82 | + # Self-contained workspace dir — see the comment above the jobs block. |
| 83 | + context: airbender_prover_server |
| 84 | + file: ${{ matrix.dockerfile }} |
| 85 | + load: true |
| 86 | + tags: | |
| 87 | + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 88 | + matterlabs/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 89 | + ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 90 | + us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.image }}:latest |
| 91 | + matterlabs/${{ matrix.image }}:latest |
| 92 | + ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:latest |
| 93 | +
|
| 94 | + - name: Push docker image |
| 95 | + if: ${{ inputs.action == 'push' }} |
| 96 | + run: | |
| 97 | + docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 98 | + docker push matterlabs/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 99 | + docker push ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ env.IMAGE_TAG_SUFFIX }} |
| 100 | + docker push us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.image }}:latest |
| 101 | + docker push matterlabs/${{ matrix.image }}:latest |
| 102 | + docker push ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:latest |
0 commit comments