mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-05 16:48:53 +00:00
Updated docker.
Removed unused py libs.
This commit is contained in:
parent
f18ab7dff7
commit
5425e537bc
3 changed files with 11 additions and 20 deletions
|
@ -59,21 +59,15 @@ async def lifespan(app: FastAPI):
|
||||||
logger.error(f"Failed to initialize model: {e}")
|
logger.error(f"Failed to initialize model: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
boundary = "░" * 2 * 12
|
|
||||||
startup_msg = f"""
|
startup_msg = f"""
|
||||||
{boundary}
|
|
||||||
|
|
||||||
╔═╗┌─┐┌─┐┌┬┐
|
╔═╗┌─┐┌─┐┌┬┐
|
||||||
╠╣ ├─┤└─┐ │
|
╠╣ ├─┤└─┐ │
|
||||||
╚ ┴ ┴└─┘ ┴
|
╚ ┴ ┴└─┘ ┴
|
||||||
╦╔═┌─┐┬┌─┌─┐
|
╦╔═┌─┐┬┌─┌─┐
|
||||||
╠╩╗│ │├┴┐│ │
|
╠╩╗│ │├┴┐│ │
|
||||||
╩ ╩└─┘┴ ┴└─┘
|
╩ ╩└─┘┴ ┴└─┘
|
||||||
|
|
||||||
{boundary}
|
|
||||||
"""
|
"""
|
||||||
|
startup_msg += f"Model loaded on {device}"
|
||||||
startup_msg += f"\nModel loaded on {device}"
|
|
||||||
if device == "mps":
|
if device == "mps":
|
||||||
startup_msg += "\nUsing Apple Metal Performance Shaders (MPS)"
|
startup_msg += "\nUsing Apple Metal Performance Shaders (MPS)"
|
||||||
elif device == "cuda":
|
elif device == "cuda":
|
||||||
|
|
|
@ -16,9 +16,7 @@ RUN apt-get update -y && \
|
||||||
USER appuser
|
USER appuser
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
|
|
||||||
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 \
|
||||||
|
@ -26,15 +24,15 @@ ENV PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
||||||
DEVICE="gpu"
|
DEVICE="gpu"
|
||||||
|
|
||||||
COPY --chown=appuser:appuser pyproject.toml ./pyproject.toml
|
COPY --chown=appuser:appuser pyproject.toml ./pyproject.toml
|
||||||
COPY --chown=appuser:appuser api ./api
|
|
||||||
COPY --chown=appuser:appuser web ./web
|
|
||||||
COPY --chown=appuser:appuser docker/scripts/ ./
|
|
||||||
RUN chmod +x ./entrypoint.sh
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv venv --python 3.10 && \
|
uv venv --python 3.10 && \
|
||||||
uv sync --extra gpu && \
|
uv sync --extra gpu && \
|
||||||
uv cache clean && \
|
uv cache clean
|
||||||
|
|
||||||
|
COPY --chown=appuser:appuser api ./api
|
||||||
|
COPY --chown=appuser:appuser web ./web
|
||||||
|
COPY --chown=appuser:appuser docker/scripts/ ./
|
||||||
|
RUN chmod +x ./entrypoint.sh && \
|
||||||
python download_model.py --output api/src/models/v1_0
|
python download_model.py --output api/src/models/v1_0
|
||||||
|
|
||||||
# Run FastAPI server through entrypoint.sh
|
# Run FastAPI server through entrypoint.sh
|
||||||
|
@ -67,8 +65,9 @@ CMD ["./entrypoint.sh"]
|
||||||
# SSH keys for logging into EC2 containers:
|
# SSH keys for logging into EC2 containers:
|
||||||
# https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#KeyPairs:
|
# https://eu-west-1.console.aws.amazon.com/ec2/home?region=eu-west-1#KeyPairs:
|
||||||
#
|
#
|
||||||
# aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 678811077621.dkr.ecr.eu-west-1.amazonaws.com
|
|
||||||
# docker build -f docker\gpu\Dockerfile -t evie/kokorotts .
|
# docker build -f docker\gpu\Dockerfile -t evie/kokorotts .
|
||||||
|
# aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin 678811077621.dkr.ecr.eu-west-1.amazonaws.com
|
||||||
# docker tag evie/kokorotts:latest 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts:latest
|
# docker tag evie/kokorotts:latest 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts:latest
|
||||||
# docker push 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts:latest
|
# docker push 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts:latest
|
||||||
# docker run --gpus all -p 8880:8880 --name kokorotts 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts
|
# docker run --gpus all -p 8880:8880 --name kokorotts 678811077621.dkr.ecr.eu-west-1.amazonaws.com/evie/kokorotts
|
||||||
|
# oe use swarm as explained here: https://blog.container-solutions.com/rolling-updates-with-docker-swarm
|
|
@ -12,7 +12,6 @@ dependencies = [
|
||||||
"pydantic==2.10.4",
|
"pydantic==2.10.4",
|
||||||
"pydantic-settings==2.7.0",
|
"pydantic-settings==2.7.0",
|
||||||
"python-dotenv==1.0.1",
|
"python-dotenv==1.0.1",
|
||||||
"sqlalchemy==2.0.27",
|
|
||||||
# ML/DL Base
|
# ML/DL Base
|
||||||
"numpy>=1.26.0",
|
"numpy>=1.26.0",
|
||||||
"scipy==1.14.1",
|
"scipy==1.14.1",
|
||||||
|
@ -28,7 +27,6 @@ dependencies = [
|
||||||
"loguru==0.7.3",
|
"loguru==0.7.3",
|
||||||
"openai>=1.59.6",
|
"openai>=1.59.6",
|
||||||
"pydub>=0.25.1",
|
"pydub>=0.25.1",
|
||||||
"matplotlib>=3.10.0",
|
|
||||||
"mutagen>=1.47.0",
|
"mutagen>=1.47.0",
|
||||||
"psutil>=6.1.1",
|
"psutil>=6.1.1",
|
||||||
"kokoro==0.9.2",
|
"kokoro==0.9.2",
|
||||||
|
|
Loading…
Add table
Reference in a new issue