mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-08-31 21:59:28 +00:00
50 lines
1.4 KiB
Docker
50 lines
1.4 KiB
Docker
FROM rocm/pytorch:rocm6.3.4_ubuntu22.04_py3.10_pytorch_release_2.4.0
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
PHONEMIZER_ESPEAK_PATH=/usr/bin \
|
|
PHONEMIZER_ESPEAK_DATA=/usr/share/espeak-ng-data \
|
|
ESPEAK_DATA_PATH=/usr/share/espeak-ng-data
|
|
|
|
# Install Python and other dependencies
|
|
RUN apt-get update && apt upgrade -y && apt-get install -y --no-install-recommends \
|
|
espeak-ng \
|
|
espeak-ng-data \
|
|
git \
|
|
libsndfile1 \
|
|
curl \
|
|
ffmpeg \
|
|
wget \
|
|
nano \
|
|
g++ \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir -p /usr/share/espeak-ng-data \
|
|
&& ln -s /usr/lib/*/espeak-ng-data/* /usr/share/espeak-ng-data/
|
|
|
|
RUN mkdir -p /app/api/src/models/v1_0
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files
|
|
COPY pyproject.toml ./pyproject.toml
|
|
|
|
# Install dependencies
|
|
RUN pip3 install -e .
|
|
|
|
# Copy project files including models
|
|
COPY --chown=appuser:appuser api ./api
|
|
COPY --chown=appuser:appuser web ./web
|
|
COPY --chown=appuser:appuser docker/scripts/ ./
|
|
RUN chmod +x ./entrypoint.sh
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app:/app/api \
|
|
USE_GPU=true \
|
|
DOWNLOAD_MODEL=true
|
|
|
|
# Download model if enabled
|
|
RUN if [ "$DOWNLOAD_MODEL" = "true" ]; then \
|
|
python download_model.py --output api/src/models/v1_0; \
|
|
fi
|
|
|
|
# Run FastAPI server through entrypoint.sh
|
|
CMD ["python3", "-m", "uvicorn", "api.src.main:app", "--host", "0.0.0.0", "--port", "8880", "--log-level", "debug"]
|