File size: 1,230 Bytes
2283a4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Dockerfile per HuggingFace Spaces - TVProxy con Gunicorn

# 1. Usa l'immagine base ufficiale di Python 3.12 slim
FROM python:3.12-slim

# 2. Installa git e certificati SSL (per clonare da GitHub e HTTPS)
RUN apt-get update && apt-get install -y \
    git \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

# 3. Imposta la directory di lavoro
WORKDIR /app

# 4. Clona il repository da GitHub
RUN git clone https://github.com/nzo66/tvproxy.git .

# 5. Aggiorna pip e installa le dipendenze senza cache
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# 6. Espone la porta 7860 per HuggingFace Spaces
EXPOSE 7860

# 7. Comando per avviare Gunicorn ottimizzato per HuggingFace Spaces
#    - 2 worker (limite per Spaces gratuiti)
#    - Worker class sync (più stabile per proxy HTTP)
#    - Timeout adeguati per streaming
#    - Logging su stdout/stderr
CMD ["gunicorn", "app:app", \
     "-w", "2", \
     "--worker-class", "sync", \
     "-b", "0.0.0.0:7860", \
     "--timeout", "120", \
     "--keep-alive", "5", \
     "--max-requests", "500", \
     "--max-requests-jitter", "50", \
     "--access-logfile", "-", \
     "--error-logfile", "-", \
     "--log-level", "info"]