Skip to content

Commit 21a78e0

Browse files
authored
fix(docker): honour HOST/PORT in entrypoint for IPv6 binds (#408), download_model defaults; drop api dev mount cruft (#522)
1 parent d2aae10 commit 21a78e0

8 files changed

Lines changed: 13 additions & 24 deletions

File tree

‎docker/cpu/docker-compose.yml‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
name: kokoro-fastapi-cpu
22
services:
33
kokoro-tts:
4-
# image: ghcr.io/remsky/kokoro-fastapi-cpu:${VERSION:-latest}
4+
image: ghcr.io/remsky/kokoro-fastapi-cpu:${VERSION:-latest}
55
build:
66
context: ../..
77
dockerfile: docker/cpu/Dockerfile.optimized
88
cache_from:
99
- ghcr.io/remsky/kokoro-fastapi-cache:cpu-amd64
1010
- ghcr.io/remsky/kokoro-fastapi-cache:cpu-arm64
1111
volumes:
12-
- ../../api:/app/api
13-
- ../../web:/app/web # hot reload the web player, files are read per request
12+
- ../../web:/app/web # hot reload changes to web player code
1413
ports:
1514
- "8880:8880"
1615
env_file:
1716
- path: ../../.env
1817
required: false
19-
environment:
20-
- PYTHONPATH=/app:/app/api
18+
environment: # full list in docs/configuration.md
2119
- API_LOG_LEVEL=DEBUG
22-
- DOWNLOAD_MODEL=true
2320
# - ALLOW_DEV_UNLOAD=true
2421
# - ENABLE_DEBUG_ENDPOINTS=true
25-

‎docker/gpu/docker-compose.yml‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: kokoro-fastapi-gpu
22
services:
33
kokoro-tts:
4-
# image: ghcr.io/remsky/kokoro-fastapi-gpu:${VERSION:-latest}
4+
image: ghcr.io/remsky/kokoro-fastapi-gpu:${VERSION:-latest}
55
build:
66
context: ../..
77
dockerfile: docker/gpu/Dockerfile.optimized
@@ -14,20 +14,14 @@ services:
1414
# GPU_EXTRA: gpu-cu128
1515
# CUDA_VERSION: 12.8.1
1616
volumes:
17-
- ../../api:/app/api
18-
- ../../web:/app/web # hot reload the web player, files are read per request
19-
user: "1001:1001" # Ensure container runs as UID 1001 (appuser)
17+
- ../../web:/app/web # hot reload changes to web player code
2018
ports:
2119
- "8880:8880"
2220
env_file:
2321
- path: ../../.env
2422
required: false
25-
environment:
26-
- PYTHONPATH=/app:/app/api
27-
- USE_GPU=true
28-
- PYTHONUNBUFFERED=1
23+
environment: # full list in docs/configuration.md
2924
- API_LOG_LEVEL=DEBUG
30-
- DOWNLOAD_MODEL=true
3125
# - ALLOW_DEV_UNLOAD=true
3226
# - ENABLE_DEBUG_ENDPOINTS=true
3327
deploy:
@@ -37,4 +31,3 @@ services:
3731
- driver: nvidia
3832
count: all
3933
capabilities: [gpu]
40-

‎docker/rocm/docker-compose.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: kokoro-fastapi-rocm
22
services:
33
kokoro-tts:
4-
# image: ghcr.io/remsky/kokoro-fastapi-rocm:${VERSION:-latest}
4+
image: ghcr.io/remsky/kokoro-fastapi-rocm:${VERSION:-latest}
55
build:
66
context: ../..
77
dockerfile: docker/rocm/Dockerfile

‎docker/scripts/entrypoint.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
set -e
33

4-
if [ "$DOWNLOAD_MODEL" = "true" ]; then
4+
if [ "${DOWNLOAD_MODEL:-true}" = "true" ]; then
55
python download_model.py --output api/src/models/v1_0
66
fi
77

8-
exec python -m uvicorn api.src.main:app --host 0.0.0.0 --port 8880 --log-level debug
8+
exec python -m uvicorn api.src.main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-8880}" --log-level debug

‎docs/configuration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Names are the field names from `api/src/core/config.py`, uppercased. Unrecognize
8181

8282
| Variable | Default | |
8383
|---|---|---|
84-
| `HOST` | `0.0.0.0` | Bind address |
84+
| `HOST` | `0.0.0.0` | Bind address, `::` for IPv6-only or dual-stack |
8585
| `PORT` | `8880` | Bind port |
8686
| `API_TITLE` | `Kokoro TTS API` | OpenAPI title |
8787
| `API_DESCRIPTION` | `API for text-to-speech generation using Kokoro` | OpenAPI description |

‎start-cpu.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ uv run --no-sync python docker/scripts/download_model.py --output api/src/models
2222
# python scripts/fix_misaki.py
2323

2424
# Start the server
25-
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 8880
25+
uv run --no-sync uvicorn api.src.main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-8880}"

‎start-gpu.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export WEB_PLAYER_PATH=$PROJECT_ROOT/web
1414
# Note: espeak may still require manual installation,
1515
uv pip install -e ".[gpu]"
1616
uv run --no-sync python docker/scripts/download_model.py --output api/src/models/v1_0
17-
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 8880
17+
uv run --no-sync uvicorn api.src.main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-8880}"

‎start-gpu_mac.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ export PYTORCH_ENABLE_MPS_FALLBACK=1
1717
# Run FastAPI with GPU extras using uv run
1818
uv pip install -e .
1919
uv run --no-sync python docker/scripts/download_model.py --output api/src/models/v1_0
20-
uv run --no-sync uvicorn api.src.main:app --host 0.0.0.0 --port 8880
20+
uv run --no-sync uvicorn api.src.main:app --host "${HOST:-0.0.0.0}" --port "${PORT:-8880}"

0 commit comments

Comments
 (0)