kokoro-sse / Dockerfile
ArunKr's picture
Create Dockerfile
d08c425 verified
raw
history blame
1.51 kB
# syntax=docker/dockerfile:1
FROM python:3.11-slim
# ---- Runtime deps for onnxruntime ----
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# ---- Install uv (Astral) ----
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
WORKDIR /app
# ---- App deps (cached) ----
COPY pyproject.toml README.md ./
RUN uv sync --no-dev
# ---- App code ----
COPY app.py ./
COPY static ./static
COPY clients ./clients
# ---- Models ----
# Set where the app expects the files
ENV KOKORO_MODEL=/app/models/kokoro-v1.0.int8.onnx \
KOKORO_VOICES=/app/models/voices-v1.0.bin
# Option 1: auto-download at build (default ON). Disable with: --build-arg DOWNLOAD_MODELS=0
ARG DOWNLOAD_MODELS=1
RUN mkdir -p /app/models && \
if [ "$DOWNLOAD_MODELS" = "1" ]; then \
echo "Downloading Kokoro model & voices..." && \
curl -L -o "${KOKORO_MODEL}" "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.int8.onnx" && \
curl -L -o "${KOKORO_VOICES}" "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/voices-v1.0.bin"; \
else \
echo "Skipping model download. Mount or COPY models into /app/models"; \
fi
# Option 2 (alternative): if you keep models/ next to Dockerfile, uncomment below
# COPY ./models ./models
EXPOSE 8000
CMD ["uv", "run", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]