feat(image-build): use Docker buildx, publish multi arch images

This commit is contained in:
ItzCrazyKns 2024-10-03 09:37:15 +05:30
parent ae3fc5f802
commit 66f1e19ce8
1 changed files with 8 additions and 8 deletions

View File

@ -17,6 +17,8 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
with:
install: true
- name: Log in to DockerHub - name: Log in to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v2
@ -32,15 +34,13 @@ jobs:
- name: Build and push Docker image - name: Build and push Docker image
if: github.ref == 'refs/heads/master' && github.event_name == 'push' if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: | run: |
docker build -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:main . docker buildx create --use
docker build -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:main . docker buildx build --platform linux/amd64,linux/arm64 -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:main --push .
docker push itzcrazykns1337/perplexica-backend:main docker buildx build --platform linux/amd64,linux/arm64 -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:main --push .
docker push itzcrazykns1337/perplexica-frontend:main
- name: Build and push release Docker image - name: Build and push release Docker image
if: github.event_name == 'release' if: github.event_name == 'release'
run: | run: |
docker build -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }} . docker buildx create --use
docker build -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }} . docker buildx build --platform linux/amd64,linux/arm64 -f backend.dockerfile -t itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }} --push .
docker push itzcrazykns1337/perplexica-backend:${{ env.RELEASE_VERSION }} docker buildx build --platform linux/amd64,linux/arm64 -f app.dockerfile -t itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }} --push .
docker push itzcrazykns1337/perplexica-frontend:${{ env.RELEASE_VERSION }}