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