tts / Dockerfile
VeuReu's picture
Upload 2 files
91d2d03 verified
# ==== Base ====
FROM python:3.11-slim
# Evita prompts de debconf y acelera pip
ENV DEBIAN_FRONTEND=noninteractive \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PYTHONUNBUFFERED=1 \
# Variables de afinidad de CPU para ONNX Runtime
OMP_NUM_THREADS=1 \
OPENBLAS_NUM_THREADS=1 \
MKL_NUM_THREADS=1 \
NUMEXPR_NUM_THREADS=1
# ==== Sistema: Instalaci贸n de dependencias (ffmpeg y espeak-ng) ====
RUN apt-get update && apt-get install -y --no-install-recommends \
espeak-ng ffmpeg libsndfile1 git \
# Librer铆as necesarias para la instalaci贸n de locales
locales \
&& rm -rf /var/lib/apt/lists/*
# Configuraci贸n del locale catal谩n (necesario para espeak-ng/phonemizer)
RUN sed -i 's/# ca_ES.UTF-8 UTF-8/ca_ES.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen
ENV LANG=ca_ES.UTF-8 \
LC_ALL=ca_ES.UTF-8
# Comando para refrescar la cach茅 de librer铆as din谩micas (importante para espeak-ng)
RUN ldconfig
# ==== App: Instalaci贸n de Python y Copia de Archivos ====
WORKDIR /app
# Copiamos todos los archivos del proyecto (incluyendo libs/ y requirements.txt)
COPY . .
# Instalaci贸n de dependencias de Python
RUN python -m pip install --upgrade pip \
&& pip install --no-cache-dir --prefer-binary -r requirements.txt
# Hugging Face expone $PORT (7860 normalmente)
ENV PORT=7860
EXPOSE 7860
# Arranque de FastAPI con Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]