fix push image #119
This file contains 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 image | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '**' | |
workflow_dispatch: | |
inputs: | |
repository: | |
default: ethpandaops/ethereum-genesis-generator | |
type: string | |
required: true | |
ref: | |
description: The branch, tag or SHA to checkout and build from | |
default: master | |
type: string | |
required: true | |
docker_tag: | |
description: Override target docker tag (defaults to the above source ref if left blank) | |
type: string | |
required: false | |
jobs: | |
build-x64: | |
name: build-x64 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Context for Buildx | |
shell: bash | |
id: buildx-context | |
run: | | |
docker context use builders || docker context create builders | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ethpandaops/ethereum-genesis-generator | |
flavor: latest=true | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
build-arm: | |
name: build-arm | |
runs-on: ARM | |
steps: | |
- name: Checkout this repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Context for Buildx | |
shell: bash | |
id: buildx-context | |
run: | | |
docker context use builders || docker context create builders | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
endpoint: builders | |
push-image: | |
needs: | |
- build-x64 | |
- build-arm | |
name: push-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: docker-build-push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: Dockerfile | |
tags: ${{ needs.build-x64.outputs.meta.tags }} | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |