FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV TF_CPP_MIN_LOG_LEVEL=2 RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ && apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH RUN mkdir -p /home/user/.deepface/weights && chmod -R 777 /home/user/.deepface RUN python - << 'PY' import numpy as np from deepface import DeepFace try: DeepFace.analyze(np.zeros((224, 224, 3), dtype=np.uint8), actions=['emotion'], enforce_detection=False) except: pass PY EXPOSE 7860 CMD ["python", "app.py"]