face-id / Dockerfile
mostaFAaa2's picture
initial deploy
0846293
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
wget \
gcc \
g++ \
cmake \
build-essential \
python3-dev \
libssl-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Upgrade pip
RUN pip install --no-cache-dir --upgrade pip --root-user-action=ignore
# Install dependencies
RUN pip install --no-cache-dir --root-user-action=ignore "numpy==1.26.4"
RUN pip install --no-cache-dir --root-user-action=ignore "onnxruntime>=1.8.0"
RUN pip install --no-cache-dir --root-user-action=ignore "opencv-python-headless>=4.5.0"
RUN pip install --no-cache-dir --root-user-action=ignore "insightface>=0.7.0"
RUN pip install --no-cache-dir --root-user-action=ignore "huggingface-hub>=0.12.0"
COPY requirements.txt .
RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
# Download the AuraFace model at BUILD time so startup is instant
RUN python -c "\
from huggingface_hub import snapshot_download; \
snapshot_download('fal/AuraFace-v1', local_dir='models/auraface/models/auraface')"
# Copy app source
COPY app.py .
# Create uploads folder
RUN mkdir -p uploads
# HuggingFace Spaces uses port 7860
ENV PORT=7860
EXPOSE 7860
CMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"]