mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
Update Docker workflow and bump version to 0.1.4
This commit is contained in:
parent
fb22264edc
commit
26a4d41ca2
3 changed files with 18 additions and 125 deletions
140
.github/workflows/docker-publish.yml
vendored
140
.github/workflows/docker-publish.yml
vendored
|
@ -1,146 +1,38 @@
|
||||||
name: Docker Build, Slim, and Publish
|
name: Docker Build and Publish
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
tags: [ 'v*.*.*' ]
|
tags: [ 'v*.*.*' ]
|
||||||
# Allow manual trigger from GitHub UI
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io
|
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
actions: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Set up QEMU
|
||||||
uses: docker/login-action@v3
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
# Set up image names (converting to lowercase)
|
- name: Run build script
|
||||||
- name: Set image names
|
|
||||||
run: |
|
run: |
|
||||||
echo "GPU_IMAGE_NAME=${{ env.REGISTRY }}/$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')-gpu" >> $GITHUB_ENV
|
chmod +x docker/build.sh
|
||||||
echo "CPU_IMAGE_NAME=${{ env.REGISTRY }}/$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')-cpu" >> $GITHUB_ENV
|
VERSION=$(cat VERSION)
|
||||||
echo "UI_IMAGE_NAME=${{ env.REGISTRY }}/$(echo ${{ env.IMAGE_NAME }} | tr '[:upper:]' '[:lower:]')-ui" >> $GITHUB_ENV
|
docker/build.sh $VERSION
|
||||||
|
|
||||||
# Build GPU version
|
|
||||||
- name: Build GPU Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./docker/gpu/Dockerfile
|
|
||||||
push: false
|
|
||||||
load: true
|
|
||||||
tags: ${{ env.GPU_IMAGE_NAME }}:v0.1.0
|
|
||||||
build-args: |
|
|
||||||
DOCKER_BUILDKIT=1
|
|
||||||
platforms: linux/amd64
|
|
||||||
|
|
||||||
# Slim GPU version
|
|
||||||
- name: Slim GPU Docker image
|
|
||||||
run: |
|
|
||||||
docker pull dslim/slim
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build \
|
|
||||||
--target ${{ env.GPU_IMAGE_NAME }}:v0.1.0 \
|
|
||||||
--tag ${{ env.GPU_IMAGE_NAME }}:v0.1.0-slim \
|
|
||||||
--include-path=/app/models \
|
|
||||||
--include-path=/app/api/src/voices \
|
|
||||||
--include-path=/app/.venv \
|
|
||||||
--include-bin=/usr/local/cuda/lib64 \
|
|
||||||
--include-bin=/usr/lib/x86_64-linux-gnu/libcudart.so \
|
|
||||||
--include-bin=/usr/lib/x86_64-linux-gnu/libcuda.so \
|
|
||||||
--include-shell \
|
|
||||||
--include-exe=python3,python3.10,espeak-ng \
|
|
||||||
--exclude-mounts=false \
|
|
||||||
--http-probe=false
|
|
||||||
|
|
||||||
# Push GPU versions
|
|
||||||
- name: Push GPU Docker images
|
|
||||||
run: |
|
|
||||||
docker push ${{ env.GPU_IMAGE_NAME }}:v0.1.0
|
|
||||||
docker push ${{ env.GPU_IMAGE_NAME }}:v0.1.0-slim
|
|
||||||
docker tag ${{ env.GPU_IMAGE_NAME }}:v0.1.0 ${{ env.GPU_IMAGE_NAME }}:latest
|
|
||||||
docker tag ${{ env.GPU_IMAGE_NAME }}:v0.1.0-slim ${{ env.GPU_IMAGE_NAME }}:latest-slim
|
|
||||||
docker push ${{ env.GPU_IMAGE_NAME }}:latest
|
|
||||||
docker push ${{ env.GPU_IMAGE_NAME }}:latest-slim
|
|
||||||
|
|
||||||
# Build CPU version
|
|
||||||
- name: Build CPU Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./docker/cpu/Dockerfile
|
|
||||||
push: false
|
|
||||||
load: true
|
|
||||||
tags: ${{ env.CPU_IMAGE_NAME }}:v0.1.0
|
|
||||||
build-args: |
|
|
||||||
DOCKER_BUILDKIT=1
|
|
||||||
platforms: linux/amd64
|
|
||||||
|
|
||||||
# Slim CPU version
|
|
||||||
- name: Slim CPU Docker image
|
|
||||||
run: |
|
|
||||||
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock dslim/slim build \
|
|
||||||
--target ${{ env.CPU_IMAGE_NAME }}:v0.1.0 \
|
|
||||||
--tag ${{ env.CPU_IMAGE_NAME }}:v0.1.0-slim \
|
|
||||||
--include-path=/app/models \
|
|
||||||
--include-path=/app/api/src/voices \
|
|
||||||
--include-path=/app/.venv \
|
|
||||||
--include-shell \
|
|
||||||
--include-exe=python3,python3.10,espeak-ng \
|
|
||||||
--exclude-mounts=false \
|
|
||||||
--http-probe=false
|
|
||||||
|
|
||||||
# Push CPU versions
|
|
||||||
- name: Push CPU Docker images
|
|
||||||
run: |
|
|
||||||
docker push ${{ env.CPU_IMAGE_NAME }}:v0.1.0
|
|
||||||
docker push ${{ env.CPU_IMAGE_NAME }}:v0.1.0-slim
|
|
||||||
docker tag ${{ env.CPU_IMAGE_NAME }}:v0.1.0 ${{ env.CPU_IMAGE_NAME }}:latest
|
|
||||||
docker tag ${{ env.CPU_IMAGE_NAME }}:v0.1.0-slim ${{ env.CPU_IMAGE_NAME }}:latest-slim
|
|
||||||
docker push ${{ env.CPU_IMAGE_NAME }}:latest
|
|
||||||
docker push ${{ env.CPU_IMAGE_NAME }}:latest-slim
|
|
||||||
|
|
||||||
# Build and push UI version
|
|
||||||
- name: Build and push UI Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: ./ui
|
|
||||||
file: ./ui/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ env.UI_IMAGE_NAME }}:v0.1.0
|
|
||||||
${{ env.UI_IMAGE_NAME }}:latest
|
|
||||||
build-args: |
|
|
||||||
DOCKER_BUILDKIT=1
|
|
||||||
platforms: linux/amd64
|
|
||||||
|
|
||||||
create-release:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# Only run this job if we're pushing a tag
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
@ -148,5 +40,5 @@ jobs:
|
||||||
IS_PRERELEASE: ${{ contains(github.ref, '-pre') }}
|
IS_PRERELEASE: ${{ contains(github.ref, '-pre') }}
|
||||||
with:
|
with:
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
draft: false
|
draft: true
|
||||||
prerelease: ${{ contains(github.ref, '-pre') }}
|
prerelease: ${{ contains(github.ref, '-pre') }}
|
||||||
|
|
1
VERSION
Normal file
1
VERSION
Normal file
|
@ -0,0 +1 @@
|
||||||
|
0.1.4
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "kokoro-fastapi"
|
name = "kokoro-fastapi"
|
||||||
version = "0.1.0"
|
version = "0.1.4"
|
||||||
description = "FastAPI TTS Service"
|
description = "FastAPI TTS Service"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|
Loading…
Add table
Reference in a new issue