aniudupa commited on
Commit
6d60372
·
verified ·
1 Parent(s): ef66fc0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -9
Dockerfile CHANGED
@@ -1,19 +1,40 @@
1
- FROM python:3.10
 
2
 
3
- # Install system dependencies
 
 
 
4
  RUN apt-get update && \
5
- apt-get install -y cmake build-essential libboost-all-dev && \
6
- apt-get clean
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Set working directory
9
  WORKDIR /app
10
 
11
- # Copy project files
 
 
 
 
 
 
12
  COPY . .
13
 
14
- # Install Python dependencies
15
- RUN pip install --upgrade pip
16
- RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # Expose port and run app
19
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use an image with Python and build tools pre-installed
2
+ FROM python:3.10-slim
3
 
4
+ # Set environment variables
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Install system dependencies for dlib and face_recognition
8
  RUN apt-get update && \
9
+ apt-get install -y \
10
+ build-essential \
11
+ cmake \
12
+ gfortran \
13
+ libopenblas-dev \
14
+ liblapack-dev \
15
+ libx11-dev \
16
+ libgtk-3-dev \
17
+ libboost-python-dev \
18
+ libboost-thread-dev \
19
+ libboost-system-dev \
20
+ python3-dev \
21
+ wget \
22
+ && rm -rf /var/lib/apt/lists/*
23
 
24
  # Set working directory
25
  WORKDIR /app
26
 
27
+ # Copy only requirements first to cache dependencies
28
+ COPY requirements.txt .
29
+
30
+ # Install Python dependencies (includes face_recognition and FastAPI)
31
+ RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
32
+
33
+ # Copy the entire app
34
  COPY . .
35
 
36
+ # Expose the app port
37
+ EXPOSE 7860
 
38
 
39
+ # Run the FastAPI app using uvicorn
40
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]