File size: 698 Bytes
152b314
 
41ce24b
 
 
152b314
 
41ce24b
 
152b314
41ce24b
152b314
41ce24b
152b314
 
41ce24b
 
 
 
152b314
41ce24b
152b314
 
 
41ce24b
 
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
FROM python:3.11-slim

# Outils minimes (curl pour healthcheck)
RUN apt-get update && apt-get install -y --no-install-recommends curl \
 && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Deps
COPY requirements.txt .
RUN python -m pip install --upgrade pip && pip install -r requirements.txt

# Code
COPY main.py .

# HF Spaces fournit PORT (ex: 7860). On met une valeur par défaut au cas où.
ENV PORT=7860

EXPOSE 7860

# Healthcheck sur /health
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
  CMD curl -fsS "http://localhost:${PORT}/health" || exit 1

# 🔑 IMPORTANT : on lance via Python, qui lit $PORT et démarre Uvicorn dessus
CMD ["python", "-u", "/app/main.py"]