Skip to content

Update Docker Build and Push action for ARM (#141) #26

Update Docker Build and Push action for ARM (#141)

Update Docker Build and Push action for ARM (#141) #26

name: Build crAPI community service
on:
pull_request:
paths:
- '.github/workflows/build-and-release-crapi-community.yml'
- 'crAPI/services/community/**'
push:
paths:
- '.github/workflows/build-and-release-crapi-community.yml'
- 'crAPI/services/community/**'
branches:
- main
tags:
- v*
workflow_dispatch:
jobs:
build-and-push-image:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build image
if: ${{ github.event_name == 'pull_request' || github.ref != 'refs/heads/main' }}
uses: docker/build-push-action@v5
with:
context: ./crAPI/services/community
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: levoai/crapi-community:pr-build
- name: Build and push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@v5
with:
context: ./crAPI/services/community
platforms: linux/amd64,linux/arm64
push: true
tags: levoai/crapi-community:latest
cache-from: type=gha
cache-to: type=gha,mode=max