Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -13
Dockerfile
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
-
# Use official Python image
|
| 2 |
FROM python:3.11-bullseye
|
| 3 |
|
| 4 |
-
# Set environment variables
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
ENV MPLCONFIGDIR="/app/matplotlib"
|
| 8 |
ENV DEEPFACE_HOME="/app/.deepface"
|
| 9 |
|
| 10 |
-
# Install system dependencies
|
| 11 |
RUN apt-get update && apt-get install -y \
|
| 12 |
build-essential \
|
| 13 |
cmake \
|
|
@@ -19,23 +16,21 @@ RUN apt-get update && apt-get install -y \
|
|
| 19 |
libpng-dev \
|
| 20 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 21 |
|
| 22 |
-
# Set working directory
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
-
# Copy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
COPY . /app
|
| 27 |
|
| 28 |
-
# Create necessary directories and
|
| 29 |
RUN mkdir -p /app/matplotlib /app/.deepface /app/tmp /app/data /app/static && \
|
| 30 |
chmod -R 777 /app/.deepface /app/matplotlib /app/tmp /app/data /app/static
|
| 31 |
|
| 32 |
-
# Install Python dependencies
|
| 33 |
-
COPY requirements.txt .
|
| 34 |
-
RUN pip install --no-cache-dir --upgrade pip && \
|
| 35 |
-
pip install --no-cache-dir -r requirements.txt
|
| 36 |
-
|
| 37 |
-
# Expose FastAPI default port
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
-
# Start FastAPI with multiple workers
|
| 41 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "8"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.11-bullseye
|
| 2 |
|
|
|
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
ENV PYTHONUNBUFFERED=1
|
| 5 |
ENV MPLCONFIGDIR="/app/matplotlib"
|
| 6 |
ENV DEEPFACE_HOME="/app/.deepface"
|
| 7 |
|
|
|
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
build-essential \
|
| 10 |
cmake \
|
|
|
|
| 16 |
libpng-dev \
|
| 17 |
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 18 |
|
|
|
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
+
# Copy only requirements first (cache-friendly)
|
| 22 |
+
COPY requirements.txt /app/
|
| 23 |
+
|
| 24 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 25 |
+
pip install --no-cache-dir -r requirements.txt
|
| 26 |
+
|
| 27 |
+
# Now copy the rest of your application
|
| 28 |
COPY . /app
|
| 29 |
|
| 30 |
+
# Create necessary directories and permissions
|
| 31 |
RUN mkdir -p /app/matplotlib /app/.deepface /app/tmp /app/data /app/static && \
|
| 32 |
chmod -R 777 /app/.deepface /app/matplotlib /app/tmp /app/data /app/static
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
EXPOSE 7860
|
| 35 |
|
|
|
|
| 36 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "8"]
|