aniudupa commited on
Commit
458d029
·
verified ·
1 Parent(s): 7d7db37

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -16
Dockerfile CHANGED
@@ -1,24 +1,40 @@
1
- FROM python:3.9-slim
 
2
 
3
- # Create user and set up environment
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
- ENV HF_HOME=/home/user/huggingface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  WORKDIR /app
9
 
10
- # Copy requirements first to leverage Docker cache
11
- COPY --chown=user ./requirements.txt .
12
- COPY --chown=user ./models ./models
13
 
14
- # Install dependencies
15
- RUN pip install --no-cache-dir --upgrade -r requirements.txt && \
16
- pip install --upgrade langchain pydantic transformers && \
17
- pip install -U langchain-huggingface faiss-gpu
18
 
19
- # Copy application code
20
- COPY --chown=user ./app.py .
21
 
 
22
  EXPOSE 7860
23
 
24
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
 
 
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"]