Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +14 -5
Dockerfile
CHANGED
|
@@ -1,17 +1,26 @@
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
|
| 5 |
WORKDIR /app
|
|
|
|
|
|
|
| 6 |
COPY requirements.txt .
|
| 7 |
-
RUN pip install
|
| 8 |
|
|
|
|
| 9 |
COPY main.py .
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
|
|
|
| 14 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
| 15 |
CMD curl -fsS "http://localhost:${PORT}/health" || exit 1
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
+
# Outils minimes (curl pour healthcheck)
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
| 5 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
+
|
| 9 |
+
# Deps
|
| 10 |
COPY requirements.txt .
|
| 11 |
+
RUN python -m pip install --upgrade pip && pip install -r requirements.txt
|
| 12 |
|
| 13 |
+
# Code
|
| 14 |
COPY main.py .
|
| 15 |
|
| 16 |
+
# HF Spaces fournit PORT (ex: 7860). On met une valeur par défaut au cas où.
|
| 17 |
+
ENV PORT=7860
|
| 18 |
+
|
| 19 |
+
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# Healthcheck sur /health
|
| 22 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
|
| 23 |
CMD curl -fsS "http://localhost:${PORT}/health" || exit 1
|
| 24 |
|
| 25 |
+
# 🔑 IMPORTANT : on lance via Python, qui lit $PORT et démarre Uvicorn dessus
|
| 26 |
+
CMD ["python", "-u", "/app/main.py"]
|