diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index 8f5ef9b2..8f3d725a 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -13,10 +13,15 @@ jobs: build: name: Docker images for ghcr.io runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest] + arch: [amd64, arm64] env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true DOCKER_REGISTRY: ghcr.io DOCKER_IMAGE_BASE: ${{ github.repository }} + DOCKER_PLATFORM: linux/${{ matrix.arch }} steps: - name: Check out the repo uses: actions/checkout@v3 @@ -31,13 +36,22 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up environment + run: | + echo "Setting up environment for ${{ matrix.arch }}" + if [ "${{ matrix.arch }}" == "amd64" ]; then + echo "TARGET_ARCH=x86_64" >> $GITHUB_ENV + elif [ "${{ matrix.arch }}" == "arm64" ]; then + echo "TARGET_ARCH=aarch64" >> $GITHUB_ENV + fi + # Prover and Verifier - name: Prover&Verifier image tags & labels id: meta-all uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/stone-prover + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/stone-prover-${TARGET_ARCH} - name: Prover&Verifier image build & push uses: docker/build-push-action@v3 @@ -45,7 +59,7 @@ jobs: context: . file: Dockerfile push: true - platforms: linux/amd64,linux/arm64 + platforms: ${{ env.DOCKER_PLATFORM }} cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ steps.meta-all.outputs.tags }} @@ -58,14 +72,14 @@ jobs: id: meta uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_prover + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_prover-${TARGET_ARCH} - name: Prover image build & push uses: docker/build-push-action@v3 with: context: . file: air_prover/Dockerfile push: true - platforms: linux/amd64,linux/arm64 + platforms: ${{ env.DOCKER_PLATFORM }} cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} @@ -77,14 +91,14 @@ jobs: id: meta-ver uses: docker/metadata-action@v3 with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_verifier + images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_BASE }}/cpu_air_verifier-${TARGET_ARCH} - name: Verifier image build & push uses: docker/build-push-action@v3 with: context: . file: air_verifier/Dockerfile push: true - platforms: linux/amd64,linux/arm64 + platforms: ${{ env.DOCKER_PLATFORM }} cache-from: type=gha cache-to: type=gha,mode=max tags: ${{ steps.meta-ver.outputs.tags }}