Upload Dockerfile
Browse files- Dockerfile +44 -56
Dockerfile
CHANGED
|
@@ -1,56 +1,44 @@
|
|
| 1 |
-
# ==== Base ====
|
| 2 |
-
FROM python:3.11-slim
|
| 3 |
-
|
| 4 |
-
# Evita prompts de debconf y acelera pip
|
| 5 |
-
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
-
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 7 |
-
PYTHONUNBUFFERED=1 \
|
| 8 |
-
# Variables de afinidad de CPU para ONNX Runtime
|
| 9 |
-
OMP_NUM_THREADS=1 \
|
| 10 |
-
OPENBLAS_NUM_THREADS=1 \
|
| 11 |
-
MKL_NUM_THREADS=1 \
|
| 12 |
-
NUMEXPR_NUM_THREADS=1
|
| 13 |
-
|
| 14 |
-
# ==== Sistema: Instalaci贸n de dependencias (ffmpeg y espeak-ng) ====
|
| 15 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
-
espeak-ng ffmpeg libsndfile1 git \
|
| 17 |
-
# Librer铆as necesarias para la instalaci贸n de locales
|
| 18 |
-
locales \
|
| 19 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
-
|
| 21 |
-
# Configuraci贸n del locale catal谩n (necesario para espeak-ng/phonemizer)
|
| 22 |
-
RUN sed -i 's/# ca_ES.UTF-8 UTF-8/ca_ES.UTF-8 UTF-8/' /etc/locale.gen && \
|
| 23 |
-
locale-gen
|
| 24 |
-
ENV LANG=ca_ES.UTF-8 \
|
| 25 |
-
LC_ALL=ca_ES.UTF-8
|
| 26 |
-
|
| 27 |
-
# Comando para refrescar la cach茅 de librer铆as din谩micas (importante para espeak-ng)
|
| 28 |
-
RUN ldconfig
|
| 29 |
-
|
| 30 |
-
# ==== App: Instalaci贸n de Python y Copia de Archivos ====
|
| 31 |
-
WORKDIR /app
|
| 32 |
-
# Copiamos
|
| 33 |
-
COPY
|
| 34 |
-
|
| 35 |
-
# Instalaci贸n de dependencias de Python
|
| 36 |
-
RUN python -m pip install --upgrade pip \
|
| 37 |
-
&& pip install --no-cache-dir --prefer-binary -r requirements.txt
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
-
&& ./install_matxa.sh || echo "Matxa installation failed, continuing..."
|
| 46 |
-
|
| 47 |
-
# Limpiamos archivos innecesarios para reducir tama帽o
|
| 48 |
-
RUN find . -name "*.pyc" -delete \
|
| 49 |
-
&& find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
|
| 50 |
-
|
| 51 |
-
# Hugging Face expone $PORT (7860 normalmente)
|
| 52 |
-
ENV PORT=7860
|
| 53 |
-
EXPOSE 7860
|
| 54 |
-
|
| 55 |
-
# Arranque de FastAPI con Uvicorn
|
| 56 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# ==== Base ====
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Evita prompts de debconf y acelera pip
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
| 6 |
+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
| 7 |
+
PYTHONUNBUFFERED=1 \
|
| 8 |
+
# Variables de afinidad de CPU para ONNX Runtime
|
| 9 |
+
OMP_NUM_THREADS=1 \
|
| 10 |
+
OPENBLAS_NUM_THREADS=1 \
|
| 11 |
+
MKL_NUM_THREADS=1 \
|
| 12 |
+
NUMEXPR_NUM_THREADS=1
|
| 13 |
+
|
| 14 |
+
# ==== Sistema: Instalaci贸n de dependencias (ffmpeg y espeak-ng) ====
|
| 15 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 16 |
+
espeak-ng ffmpeg libsndfile1 git \
|
| 17 |
+
# Librer铆as necesarias para la instalaci贸n de locales
|
| 18 |
+
locales \
|
| 19 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
+
|
| 21 |
+
# Configuraci贸n del locale catal谩n (necesario para espeak-ng/phonemizer)
|
| 22 |
+
RUN sed -i 's/# ca_ES.UTF-8 UTF-8/ca_ES.UTF-8 UTF-8/' /etc/locale.gen && \
|
| 23 |
+
locale-gen
|
| 24 |
+
ENV LANG=ca_ES.UTF-8 \
|
| 25 |
+
LC_ALL=ca_ES.UTF-8
|
| 26 |
+
|
| 27 |
+
# Comando para refrescar la cach茅 de librer铆as din谩micas (importante para espeak-ng)
|
| 28 |
+
RUN ldconfig
|
| 29 |
+
|
| 30 |
+
# ==== App: Instalaci贸n de Python y Copia de Archivos ====
|
| 31 |
+
WORKDIR /app
|
| 32 |
+
# Copiamos todos los archivos del proyecto (incluyendo libs/ y requirements.txt)
|
| 33 |
+
COPY . .
|
| 34 |
+
|
| 35 |
+
# Instalaci贸n de dependencias de Python
|
| 36 |
+
RUN python -m pip install --upgrade pip \
|
| 37 |
+
&& pip install --no-cache-dir --prefer-binary -r requirements.txt
|
| 38 |
+
|
| 39 |
+
# Hugging Face expone $PORT (7860 normalmente)
|
| 40 |
+
ENV PORT=7860
|
| 41 |
+
EXPOSE 7860
|
| 42 |
+
|
| 43 |
+
# Arranque de FastAPI con Uvicorn
|
| 44 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|