File size: 1,192 Bytes
93aade3
 
 
30b5e11
 
f3a56a5
93aade3
 
f3a56a5
93aade3
b54b689
 
 
f3a56a5
 
b54b689
 
93aade3
f3a56a5
93aade3
b54b689
93aade3
30b5e11
b54b689
93aade3
b54b689
93aade3
b54b689
30b5e11
93aade3
 
f3a56a5
93aade3
 
30b5e11
93aade3
 
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
# Utilisation d'une base CUDA optimisée pour les performances
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04

WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV MODEL_PATH=/app/model_cache

# Installation des dépendances système
RUN apt-get update && apt-get install -y \

    python3-pip \
    python3-dev \
    libgomp1 \
    git \
    && rm -rf /var/lib/apt/lists/*

# Installation de PyTorch et des bibliothèques de calcul
RUN pip3 install --no-cache-dir --upgrade pip
RUN pip3 install --no-cache-dir torch torchvision torchaudio

# Copie et installation des dépendances Python
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
RUN pip3 install --upgrade transformers accelerate bitsandbytes sentence-transformers faiss-cpu

# Copie de tout le projet (incluant tools/, static/, etc.)
COPY . .

# Création des dossiers nécessaires avec les bons droits
RUN mkdir -p /app/model_cache /app/static /app/data && chmod -R 777 /app

# Port imposé par Hugging Face Spaces
EXPOSE 7860

# Lancement de l'API sur le port 7860
CMD ["python3", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]