Use buildx to create multi platform docker image

This commit is contained in:
Debanjum 2024-12-11 00:21:29 -08:00
parent ec797bc6b8
commit 59008ae90e

View file

@ -120,6 +120,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
steps: steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry - name: Login to GitHub Container Registry
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
@ -130,15 +133,15 @@ jobs:
- name: Create and Push Local Manifest - name: Create and Push Local Manifest
if: github.event.inputs.khoj == 'true' || github.event_name == 'push' if: github.event.inputs.khoj == 'true' || github.event_name == 'push'
run: | run: |
docker manifest create ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }} \ docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }} \
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-amd64 \ ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-amd64 \
ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-arm64 ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}-arm64
docker manifest push ghcr.io/${{ github.repository }}:${{ env.DOCKER_IMAGE_TAG }}
- name: Create and Push Cloud Manifest - name: Create and Push Cloud Manifest
if: github.event.inputs.khoj-cloud == 'true' || github.event_name == 'push' if: github.event.inputs.khoj-cloud == 'true' || github.event_name == 'push'
run: | run: |
docker manifest create ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }} \ docker buildx imagetools create \
-t ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }} \
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-amd64 \ ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-amd64 \
ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-arm64 ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}-arm64
docker manifest push ghcr.io/${{ github.repository }}-cloud:${{ env.DOCKER_IMAGE_TAG }}