# ==== 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"]