diff --git a/.github/workflows/docker-build-push-backend-container-on-tag.yml b/.github/workflows/docker-build-push-backend-container-on-tag.yml index f88bc949f46..dc0b0901a42 100644 --- a/.github/workflows/docker-build-push-backend-container-on-tag.yml +++ b/.github/workflows/docker-build-push-backend-container-on-tag.yml @@ -26,6 +26,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY_IMAGE }} + tags: | + type=raw,value=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} + type=raw,value=${{ env.REGISTRY_IMAGE }}:latest,enable=${{ github.ref == 'refs/heads/main' }} + - name: Backend Image Docker Build and Push uses: docker/build-push-action@v5 with: @@ -33,9 +42,7 @@ jobs: file: ./backend/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: | - ${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} - ${{ env.REGISTRY_IMAGE }}:latest + tags: ${{ steps.meta.outputs.tags }} build-args: | DANSWER_VERSION=${{ github.ref_name }} cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache diff --git a/.github/workflows/docker-build-push-web-container-on-tag.yml b/.github/workflows/docker-build-push-web-container-on-tag.yml index 13f59b7b8b4..e880afed19c 100644 --- a/.github/workflows/docker-build-push-web-container-on-tag.yml +++ b/.github/workflows/docker-build-push-web-container-on-tag.yml @@ -34,7 +34,7 @@ jobs: images: ${{ env.REGISTRY_IMAGE }} tags: | type=raw,value=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }} - type=raw,value=${{ env.REGISTRY_IMAGE }}:latest + type=raw,value=${{ env.REGISTRY_IMAGE }}:latest,enable=${{ github.ref == 'refs/heads/main' }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3