File size: 970 Bytes
bf6cb47
f718129
 
bf6cb47
f718129
 
 
 
 
bf6cb47
 
 
 
 
 
 
 
 
 
 
 
 
f718129
bf6cb47
f718129
 
 
bf6cb47
 
f718129
bf6cb47
 
f718129
bf6cb47
f718129
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
# Utiliser une image Python officielle légère
FROM python:3.10-slim

# Installer les outils système essentiels
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Créer un utilisateur non-root (UID 1000) requis par Hugging Face Spaces
RUN useradd -m -u 1000 user
USER user

# Configurer les variables d'environnement de l'utilisateur
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Définir le dossier de travail
WORKDIR $HOME/app

# Copier d'abord le fichier des dépendances pour le cache Docker
COPY --chown=user requirements.txt $HOME/app/requirements.txt

# Installer les dépendances Python
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copier le reste du code source du projet
COPY --chown=user . $HOME/app

# Hugging Face écoute obligatoirement sur le port 7860
EXPOSE 7860

# Lancer l'application
CMD ["python", "app.py"]