-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
30 lines (22 loc) · 820 Bytes
/
Dockerfile
File metadata and controls
30 lines (22 loc) · 820 Bytes
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
FROM python:3.10-slim
# Installer dépendances système nécessaires pour torch et transformers
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copier le fichier requirements.txt
COPY requirements.txt .
# Upgrade pip
RUN pip install --upgrade pip
# Installer les dépendances Python, incluant torch CPU
RUN pip install --no-cache-dir torch==2.2.0 -f https://download.pytorch.org/whl/cpu/torch_stable.html
RUN pip install --no-cache-dir "numpy<2"
RUN pip install --no-cache-dir -r requirements.txt
# Copier le reste du projet
COPY . .
# Exposer le port 7860 (obligatoire pour HF Spaces)
EXPOSE 7860
# Lancer FastAPI via Uvicorn (forme JSON recommandée)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]