MinaNasser commited on
Commit
a597565
·
1 Parent(s): 12d0de7
Files changed (1) hide show
  1. Dockerfile +13 -11
Dockerfile CHANGED
@@ -2,33 +2,35 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies for OpenCV and other libraries
6
  RUN apt-get update && apt-get install -y \
7
- libgl1-mesa-glx \
8
  libglib2.0-0 \
9
  libsm6 \
10
  libxext6 \
11
- libxrender-dev \
12
  libgomp1 \
13
- libglib2.0-0 \
14
  wget \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
  # Copy requirements first for better caching
18
  COPY requirements.txt .
19
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
20
 
21
  # Copy the rest of the application
22
  COPY . .
23
 
24
- # Create assets directory and download YOLO model
25
- RUN mkdir -p assets && \
26
- wget -O assets/yolov11n-face.pt https://github.com/YapaLab/yolo-face/releases/download/1.0.0/yolov11n-face.pt || true
27
 
28
- # Create directories for ChromaDB and static files
29
- RUN mkdir -p chroma_data static/crops
 
 
30
 
31
- # Expose port (Hugging Face Spaces uses 7860 by default)
32
  EXPOSE 7860
33
 
34
  # Run the application
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install only essential system dependencies
6
  RUN apt-get update && apt-get install -y \
 
7
  libglib2.0-0 \
8
  libsm6 \
9
  libxext6 \
10
+ libxrender1 \
11
  libgomp1 \
 
12
  wget \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
  # Copy requirements first for better caching
16
  COPY requirements.txt .
17
+
18
+ # Install Python dependencies
19
+ RUN pip install --no-cache-dir --upgrade pip && \
20
+ pip install --no-cache-dir -r requirements.txt
21
 
22
  # Copy the rest of the application
23
  COPY . .
24
 
25
+ # Create necessary directories
26
+ RUN mkdir -p assets chroma_data static/crops
 
27
 
28
+ # Download YOLO model
29
+ RUN wget -O assets/yolov11n-face.pt \
30
+ https://github.com/YapaLab/yolo-face/releases/download/1.0.0/yolov11n-face.pt \
31
+ || echo "Model download failed, will download on first run"
32
 
33
+ # Expose port
34
  EXPOSE 7860
35
 
36
  # Run the application