Updated workflow to achieve multi-arch build on an automated way. #5
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
# This workflow only handles build & push of images to GitHub Container Registry. | |
# We have other pipepines in CircleCI, such as tests, that are not migrated to GitHub Actions. | |
name: Build and push images | |
on: | |
workflow_dispatch: | |
push: | |
branches: [geo-mesh] | |
tags: ['*'] | |
pull_request: | |
branches: [geo-mesh] | |
jobs: | |
build-images: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Docker Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker Metadata action | |
id: meta | |
uses: docker/metadata-action@v4 | |
env: | |
DOCKER_METADATA_PR_HEAD_SHA: "true" | |
with: | |
images: | | |
poktscan/pocket-core | |
tags: | | |
type=schedule | |
type=ref,event=tag | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
type=sha,format=long | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
file: .github/workflows/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |