File size: 1,121 Bytes
af8a801 f85df4e af8a801 |
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 |
FROM python:3.11-slim
# SO deps necesarias para audio/vídeo/OCR
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg libsndfile1 libsm6 libxext6 libgl1 tesseract-ocr build-essential sqlite3 libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Crear directorios para caché y dar permisos
RUN mkdir -p /app/data/.cache /app/data/.deepface /app/data/.config/matplotlib \
&& chmod -R 777 /app/data
# Variables de entorno para que librerías escriban en /app/data
ENV HOME=/app/data \
DEEPFACE_HOME=/app/data/.deepface \
MPLCONFIGDIR=/app/data/.config/matplotlib \
TRANSFORMERS_CACHE=/app/data/.cache/huggingface \
HF_HOME=/app/data/.cache/huggingface \
XDG_CACHE_HOME=/app/data/.cache \
PORT=7860
# Mejora estabilidad de instalación de wheels
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Instala deps primero (mejor cacheo)
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
# Copia el código
COPY . /app
# Lanza FastAPI
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
|