mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
Refactor Docker workflows to consolidate image builds and add phonemizer environment variables
This commit is contained in:
parent
ac7947b51a
commit
16e4a88e83
3 changed files with 11 additions and 62 deletions
65
.github/workflows/docker-publish.yml
vendored
65
.github/workflows/docker-publish.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
id: check-prerelease
|
id: check-prerelease
|
||||||
run: echo "is_prerelease=${{ contains(github.ref, '-pre') }}" >> $GITHUB_OUTPUT
|
run: echo "is_prerelease=${{ contains(github.ref, '-pre') }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
build-cpu:
|
build-images:
|
||||||
needs: prepare-release
|
needs: prepare-release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -62,71 +62,16 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push CPU image
|
- name: Build and push images
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: 1
|
DOCKER_BUILDKIT: 1
|
||||||
BUILDKIT_STEP_LOG_MAX_SIZE: 10485760
|
BUILDKIT_STEP_LOG_MAX_SIZE: 10485760
|
||||||
|
VERSION: ${{ needs.prepare-release.outputs.version }}
|
||||||
run: |
|
run: |
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
docker buildx bake --push
|
||||||
-t ghcr.io/remsky/kokoro-fastapi-cpu:${{ needs.prepare-release.outputs.version }} \
|
|
||||||
-t ghcr.io/remsky/kokoro-fastapi-cpu:latest \
|
|
||||||
-f docker/cpu/Dockerfile \
|
|
||||||
--push \
|
|
||||||
--build-arg BUILDKIT_INLINE_CACHE=1 .
|
|
||||||
|
|
||||||
build-gpu:
|
|
||||||
needs: prepare-release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Free disk space
|
|
||||||
run: |
|
|
||||||
echo "Listing current disk space"
|
|
||||||
df -h
|
|
||||||
echo "Cleaning up disk space..."
|
|
||||||
sudo rm -rf /usr/share/dotnet
|
|
||||||
sudo rm -rf /usr/local/lib/android
|
|
||||||
sudo rm -rf /opt/ghc
|
|
||||||
sudo rm -rf /opt/hostedtoolcache
|
|
||||||
docker system prune -af
|
|
||||||
echo "Disk space after cleanup"
|
|
||||||
df -h
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
with:
|
|
||||||
driver-opts: |
|
|
||||||
image=moby/buildkit:latest
|
|
||||||
network=host
|
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Build and push GPU image
|
|
||||||
env:
|
|
||||||
DOCKER_BUILDKIT: 1
|
|
||||||
BUILDKIT_STEP_LOG_MAX_SIZE: 10485760
|
|
||||||
run: |
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
|
||||||
-t ghcr.io/remsky/kokoro-fastapi-gpu:${{ needs.prepare-release.outputs.version }} \
|
|
||||||
-t ghcr.io/remsky/kokoro-fastapi-gpu:latest \
|
|
||||||
-f docker/gpu/Dockerfile \
|
|
||||||
--push \
|
|
||||||
--build-arg BUILDKIT_INLINE_CACHE=1 .
|
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
needs: [prepare-release, build-cpu, build-gpu]
|
needs: [prepare-release, build-images]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
|
@ -44,7 +44,9 @@ ENV PYTHONUNBUFFERED=1 \
|
||||||
PYTHONPATH=/app:/app/api \
|
PYTHONPATH=/app:/app/api \
|
||||||
PATH="/app/.venv/bin:$PATH" \
|
PATH="/app/.venv/bin:$PATH" \
|
||||||
UV_LINK_MODE=copy \
|
UV_LINK_MODE=copy \
|
||||||
USE_GPU=false
|
USE_GPU=false \
|
||||||
|
PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
||||||
|
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data
|
||||||
|
|
||||||
ENV DOWNLOAD_MODEL=true
|
ENV DOWNLOAD_MODEL=true
|
||||||
# Download model if enabled
|
# Download model if enabled
|
||||||
|
|
|
@ -47,7 +47,9 @@ ENV PYTHONUNBUFFERED=1 \
|
||||||
PYTHONPATH=/app:/app/api \
|
PYTHONPATH=/app:/app/api \
|
||||||
PATH="/app/.venv/bin:$PATH" \
|
PATH="/app/.venv/bin:$PATH" \
|
||||||
UV_LINK_MODE=copy \
|
UV_LINK_MODE=copy \
|
||||||
USE_GPU=true
|
USE_GPU=true \
|
||||||
|
PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
||||||
|
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data
|
||||||
|
|
||||||
ENV DOWNLOAD_MODEL=true
|
ENV DOWNLOAD_MODEL=true
|
||||||
# Download model if enabled
|
# Download model if enabled
|
||||||
|
|
Loading…
Add table
Reference in a new issue