sahra02 commited on
Commit
b819584
·
verified ·
1 Parent(s): 56b48f7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -16
Dockerfile CHANGED
@@ -1,11 +1,10 @@
1
- # Dockerfile pour Hugging Face Spaces
2
  FROM python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
- # Installer les dépendances système nécessaires
7
  RUN apt-get update && apt-get install -y \
8
- libgl1 \
9
  libglib2.0-0 \
10
  libsm6 \
11
  libxext6 \
@@ -13,21 +12,15 @@ RUN apt-get update && apt-get install -y \
13
  libgomp1 \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Copier les fichiers de dépendances
17
  COPY requirements.txt .
 
18
 
19
- # Installer les dépendances Python
20
- RUN pip install --no-cache-dir --upgrade pip && \
21
- pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copier tous les fichiers de l'application
24
- COPY . .
25
-
26
- # Télécharger le modèle YOLO au build time (pour éviter de le télécharger à chaque démarrage)
27
- RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')" || echo "YOLO download skipped"
28
-
29
- # Exposer le port 7860 (requis par Hugging Face Spaces)
30
  EXPOSE 7860
31
 
32
- # Commande pour lancer l'API FastAPI avec uvicorn
33
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
 
1
  FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
+ libgl1-mesa-glx \
8
  libglib2.0-0 \
9
  libsm6 \
10
  libxext6 \
 
12
  libgomp1 \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Copy requirements and install Python dependencies
16
  COPY requirements.txt .
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
 
19
+ # Copy application code
20
+ COPY app.py .
 
21
 
22
+ # Expose port
 
 
 
 
 
 
23
  EXPOSE 7860
24
 
25
+ # Run the application
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]