mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
ci: update docker workflow to only build on releases
This commit is contained in:
parent
fe114c3367
commit
65bf15f153
1 changed files with 3 additions and 29 deletions
32
.github/workflows/docker-publish.yml
vendored
32
.github/workflows/docker-publish.yml
vendored
|
@ -2,20 +2,7 @@ name: Docker Build and Publish
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
tags: [ 'v*.*.*' ]
|
||||
paths:
|
||||
- '**.py'
|
||||
- '**/Dockerfile*'
|
||||
- '**/docker-compose*.yml'
|
||||
- 'requirements*.txt'
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
paths:
|
||||
- '**.py'
|
||||
- '**/Dockerfile*'
|
||||
- '**/docker-compose*.yml'
|
||||
- 'requirements*.txt'
|
||||
# Allow manual trigger from GitHub UI
|
||||
workflow_dispatch:
|
||||
|
||||
|
@ -35,7 +22,6 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
|
@ -49,13 +35,9 @@ jobs:
|
|||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
# Extract metadata for CPU image
|
||||
- name: Extract metadata (tags, labels) for CPU Docker
|
||||
|
@ -66,13 +48,9 @@ jobs:
|
|||
flavor: |
|
||||
suffix=-cpu
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
# Build and push GPU version
|
||||
- name: Build and push GPU Docker image
|
||||
|
@ -80,7 +58,7 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: true
|
||||
tags: ${{ steps.meta-gpu.outputs.tags }}
|
||||
labels: ${{ steps.meta-gpu.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
|
@ -91,7 +69,7 @@ jobs:
|
|||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.cpu
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: true
|
||||
tags: ${{ steps.meta-cpu.outputs.tags }}
|
||||
labels: ${{ steps.meta-cpu.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
|
@ -105,13 +83,9 @@ jobs:
|
|||
flavor: |
|
||||
suffix=-ui
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
type=sha
|
||||
|
||||
# Build and push UI version
|
||||
- name: Build and push UI Docker image
|
||||
|
@ -119,7 +93,7 @@ jobs:
|
|||
with:
|
||||
context: ./ui
|
||||
file: ./ui/Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: true
|
||||
tags: ${{ steps.meta-ui.outputs.tags }}
|
||||
labels: ${{ steps.meta-ui.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
|
|
Loading…
Add table
Reference in a new issue