Add Multi-Arch build workflow for github

This commit is contained in:
Reza Behzadan 2025-01-03 11:52:26 -05:00
parent 3dce43f0be
commit a8360b2492

View File

@ -1,4 +1,4 @@
name: Build and Publish Docker Image
name: Build and Publish Docker Image (Multi-Arch)
on:
release:
@ -11,13 +11,15 @@ env:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
- name: Checkout code
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} .
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
@ -25,8 +27,13 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push Docker image to Docker Hub
run: |
docker push ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
docker tag ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:latest
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}