Add multi-arch Docker build support to GitHub Actions
This commit is contained in:
committed by
Aditya Chandel
parent
123c0e9b7d
commit
c1d1842c94
@@ -20,6 +20,12 @@ jobs:
|
|||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
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
|
- name: Get Latest Master Version
|
||||||
id: get_version
|
id: get_version
|
||||||
run: |
|
run: |
|
||||||
@@ -63,19 +69,21 @@ jobs:
|
|||||||
git tag ${{ env.new_tag }}
|
git tag ${{ env.new_tag }}
|
||||||
git push origin ${{ env.new_tag }}
|
git push origin ${{ env.new_tag }}
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build and Push Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }} .
|
docker buildx create --use
|
||||||
|
docker buildx build \
|
||||||
- name: Push Docker Image to GHCR
|
--platform linux/amd64,linux/arm64 \
|
||||||
run: |
|
--tag ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }} \
|
||||||
docker push ghcr.io/${{ github.actor }}/booklore-app:${{ env.image_tag }}
|
--push .
|
||||||
|
|
||||||
- name: Push Latest Tag (Only for Master)
|
- name: Push Latest Tag (Only for Master)
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
run: |
|
run: |
|
||||||
docker tag ghcr.io/${{ github.actor }}/booklore-app:${{ env.new_tag }} ghcr.io/${{ github.actor }}/booklore-app:latest
|
docker buildx build \
|
||||||
docker push ghcr.io/${{ github.actor }}/booklore-app:latest
|
--platform linux/amd64,linux/arm64 \
|
||||||
|
--tag ghcr.io/${{ github.actor }}/booklore-app:latest \
|
||||||
|
--push .
|
||||||
|
|
||||||
- name: Create GitHub Release (Only for Master)
|
- name: Create GitHub Release (Only for Master)
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/master'
|
||||||
|
|||||||
Reference in New Issue
Block a user