# Start with a standard Python 3.9 image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Final Solution: Set the home directory for deepface to the universally writable /tmp folder ENV DEEPFACE_HOME=/tmp/.deepface # Install all required system dependencies for OpenCV in one command RUN apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 # Copy the requirements file into the container COPY requirements.txt . # Install the Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy your application code into the container COPY . . # Expose the port the app will run on EXPOSE 7860 # Define the command to run your application using the Gunicorn server CMD ["gunicorn", "--workers", "1", "--threads", "4", "--bind", "0.0.0.0:7860", "app:app"]