FROM python:3.9-slim # Instalar dependencias de sistema RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Copiar requerimientos e instalar COPY app/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Descargar modelos de Face API durante el build # Nota: wget ya no es necesario instalarlo aquí si se fusionaron los comandos, pero lo mantenemos por modularidad RUN mkdir -p static/models && \ apt-get update && apt-get install -y wget && \ wget -P static/models/ \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/tiny_face_detector_model-weights_manifest.json \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/tiny_face_detector_model-shard1 \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_landmark_68_model-weights_manifest.json \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_landmark_68_model-shard1 \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_recognition_model-weights_manifest.json \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_recognition_model-shard1 \ https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_recognition_model-shard2 \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copiar la aplicación COPY app/ . # Exponer el puerto de Hugging Face EXPOSE 7860 # Ejecutar con Gunicorn y worker de eventlet para soportar Socket.IO # Usamos -w 1 porque el bot de Telegram corre en un hilo dentro del proceso # y no queremos múltiples instancias del bot (409 Conflict) CMD ["gunicorn", "--worker-class", "eventlet", "-w", "1", "-b", "0.0.0.0:7860", "main:app"]