Update docker-build.yaml

This commit is contained in:
Christian Krakau-Louis
2025-03-28 23:31:49 +01:00
committed by GitHub
parent a050cb50ce
commit ef6ea291d5
+25 -12
View File
@@ -16,8 +16,11 @@ on:
branches:
- main
env:
IMAGE_NAME: christianlouis/document-processor
jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
@@ -25,16 +28,16 @@ jobs:
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
@@ -44,19 +47,29 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
- name: Extract metadata for tags
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_NAME }}
ghcr.io/${{ github.repository_owner }}/document-processor
- name: Build and Push Docker Image with Provenance and SBOM
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
file: Dockerfile
platforms: linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
sbom: true
provenance: mode=max
tags: |
christianlouis/document-processor:latest
christianlouis/document-processor:${{ github.sha }}
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
ghcr.io/${{ github.repository_owner }}/document-processor:latest
ghcr.io/${{ github.repository_owner }}/document-processor:${{ github.sha }}
${{ startsWith(github.ref, 'refs/tags/') && format('christianlouis/document-processor:{0}', env.VERSION) || '' }}
${{ startsWith(github.ref, 'refs/tags/') && format('{0}:{1}', env.IMAGE_NAME, env.VERSION) || '' }}
${{ startsWith(github.ref, 'refs/tags/') && format('ghcr.io/{0}/document-processor:{1}', github.repository_owner, env.VERSION) || '' }}
cache-from: type=gha
cache-to: type=gha,mode=max