Add multi-arch Docker build support to GitHub Actions

This commit is contained in:
aditya.chandel
2025-03-22 02:38:44 -06:00
committed by Aditya Chandel
parent 6631b44bbc
commit 05b7be093c

View File

@@ -20,6 +20,12 @@ jobs:
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up QEMU for multi-arch builds
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get Latest Master Version
id: get_version
run: |
@@ -63,19 +69,21 @@ jobs:
git tag ${{ env.new_tag }}
git push origin ${{ env.new_tag }}
- name: Build Docker Image
- name: Build and Push Docker Image
run: |
docker build -t ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }} .
- name: Push Docker Image to GHCR
run: |
docker push ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }}
docker buildx create --use
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }} \
--push .
- name: Push Latest Tag (Only for Master)
if: github.ref == 'refs/heads/master'
run: |
docker tag ghcr.io/${{ github.actor }}/booklore-app:${{ env.new_tag }} ghcr.io/${{ github.actor }}/booklore-app:latest
docker push ghcr.io/${{ github.actor }}/booklore-app:latest
docker buildx build \
--platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.actor }}/booklore-app:latest \
--push .
- name: Create GitHub Release (Only for Master)
if: github.ref == 'refs/heads/master'