From ce189dfe07505109368eca5c45e4d1ef330eba82 Mon Sep 17 00:00:00 2001 From: Giuseppe Valente Date: Tue, 8 Aug 2023 18:07:02 +0200 Subject: [PATCH] chore: add docker build workflow --- .github/workflows/docker.yml | 82 ++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000000..0ea1d4bbc12a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,82 @@ +name: docker-prysm + +on: + push: + paths: + - '.github/workflows/docker.yml' + - 'Dockerfile' + branches: + - '**' + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + build-ref: + description: 'The git ref to build from' + type: string + default: '' + required: false + +env: + REGISTRY_IMAGE_PREFIX: ghcr.io/polymerdao/prysm + +jobs: + build: + runs-on: ubuntu-22.04-16core + strategy: + fail-fast: true + matrix: + binary: + - beacon-chain + - prysmctl + - validator + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.build-ref }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ env.REGISTRY_IMAGE_PREFIX }}-${{ matrix.binary }} + tags: | + type=sha + type=semver,pattern={{raw}} + labels: | + org.opencontainers.image.source=https://github.com/polymerdao/ibc-sdk + org.opencontainers.image.title=prysm + org.opencontainers.image.url=https://github.com/polymerdao/ibc-sdk + + + - name: Authenticate Docker + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.PACKAGES_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build and push + uses: docker/build-push-action@v4 + env: + REGISTRY_IMAGE: ${{ env.REGISTRY_IMAGE_PREFIX }}-${{ matrix.binary }} + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + provenance: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BINARY=${{ matrix.binary }} + # TODO: these cause the runner to hang and crash + # cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache + # cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache,mode=max