Update Dockerfile
Browse files- Dockerfile +32 -16
Dockerfile
CHANGED
@@ -1,24 +1,40 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
WORKDIR /app
|
9 |
|
10 |
-
# Copy requirements first to
|
11 |
-
COPY
|
12 |
-
COPY --chown=user ./models ./models
|
13 |
|
14 |
-
# Install dependencies
|
15 |
-
RUN pip install --no-cache-dir
|
16 |
-
pip install --upgrade langchain pydantic transformers && \
|
17 |
-
pip install -U langchain-huggingface faiss-gpu
|
18 |
|
19 |
-
# Copy
|
20 |
-
COPY
|
21 |
|
|
|
22 |
EXPOSE 7860
|
23 |
|
24 |
-
|
|
|
|
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"]
|