File size: 1,425 Bytes
91d2d03
4eab6bb
 
91d2d03
 
 
4eab6bb
91d2d03
 
 
 
 
4eab6bb
91d2d03
 
 
 
 
 
 
 
 
 
 
 
4eab6bb
91d2d03
 
 
 
 
 
 
ce57807
91d2d03
 
 
4eab6bb
91d2d03
 
4eab6bb
 
91d2d03
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# ==== 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"]