diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 4699146d4..27b8041c1 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -1,4 +1,4 @@ -# Build image and push it to docker hub +# Build Docker image and push it to docker hub name: Docker Image Build and Push to DockerHub @@ -11,6 +11,18 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + ${{ vars.DOCKERHUB_USERNAME }}/service + # Docker tags to generate + tags: | + type=raw,value=latest + type=sha + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -28,6 +40,5 @@ jobs: with: push: true platforms: linux/amd64,linux/arm64 - tags: | - ${{ vars.DOCKERHUB_USERNAME }}/service:latest - ${{ vars.DOCKERHUB_USERNAME }}/service:${{ env.GITHUB_SHA }} + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }}