Update docker-build.yaml
This commit is contained in:
committed by
GitHub
parent
9e7cef8402
commit
60bcf7d964
@@ -9,6 +9,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
- develop
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
- '[0-9]+.*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -16,6 +19,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -36,19 +40,23 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and Push
|
- name: Extract Git Tag (if applicable)
|
||||||
|
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
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
# Specify target platforms
|
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
push: true
|
push: true
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
tags: |
|
tags: |
|
||||||
christianlouis/document-processor:latest
|
christianlouis/document-processor:latest
|
||||||
christianlouis/document-processor:${{ github.sha }}
|
christianlouis/document-processor:${{ github.sha }}
|
||||||
ghcr.io/${{ github.repository_owner }}/document-processor:latest
|
ghcr.io/${{ github.repository_owner }}/document-processor:latest
|
||||||
ghcr.io/${{ github.repository_owner }}/document-processor:${{ github.sha }}
|
ghcr.io/${{ github.repository_owner }}/document-processor:${{ github.sha }}
|
||||||
# Cache options (optional)
|
${{ startsWith(github.ref, 'refs/tags/') && format('christianlouis/document-processor:{0}', env.VERSION) || '' }}
|
||||||
cache-from: type=gha
|
${{ startsWith(github.ref, 'refs/tags/') && format('ghcr.io/{0}/document-processor:{1}', github.repository_owner, env.VERSION) || '' }}
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|||||||
Reference in New Issue
Block a user