MFAF-Net / Dockerfile
haresh2792005's picture
Upload MFAF-Net (model)
c4a514c verified
Raw History Blame Contribute Delete
1.27 kB
FROM python:3.10-slim
# System dependencies required by OpenCV & MediaPipe
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Hugging Face Spaces requires non-root user UID 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
PORT=7860
WORKDIR $HOME/app
# Install Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code & trained checkpoint
COPY --chown=user . .
# Ensure writable runtime directories exist
RUN mkdir -p static/results static/uploads data models
# Pre-download MediaPipe FaceLandmarker model if not already present in models/
RUN if [ ! -f models/face_landmarker.task ]; then \
curl -L -o models/face_landmarker.task \
"https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task"; \
fi
EXPOSE 7860
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "4", "--timeout", "120", "app:app"]