File size: 1,842 Bytes
a568b10
 
bef65e0
a568b10
 
 
 
 
 
6aee8f5
a568b10
 
 
c560adf
f30ec89
bef65e0
c560adf
bef65e0
c560adf
 
 
 
 
 
 
 
 
6aee8f5
a568b10
 
6aee8f5
 
a568b10
6aee8f5
 
 
 
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
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"]