FaceCam / Dockerfile
Muhammad Taqi Raza
pytorch versioning
56b3e88
FROM pytorch/pytorch:2.4.1-cuda12.4-cudnn9-devel
# Set non-interactive to avoid timezone prompts etc
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies required for OpenCV and compiling pip packages
RUN apt-get update && apt-get install -y \
git \
wget \
ffmpeg \
libsm6 \
libxext6 \
libgl1-mesa-glx \
&& rm -rf /var/lib/apt/lists/*
# Set up a non-root user for Hugging Face Spaces (UID 1000)
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR /app
# Explicitly assign ownership of /app to the user
RUN chown -R user:user /app
COPY --chown=user:user . /app
USER user
# Install build dependencies and base packages
RUN pip install --no-cache-dir ninja typing-extensions
# Install specialized CUDA extensions
RUN TORCH_CUDA_ARCH_LIST="8.0;8.6;8.9;9.0" pip install --no-cache-dir git+https://github.com/graphdeco-inria/diff-gaussian-rasterization --no-build-isolation
# Install everything else from pyproject.toml
RUN pip install -e .
# Set environments for models and Gradio
ENV FACECAM_MODELS_DIR=/app/models
ENV FACECAM_CKPTS_DIR=/app/ckpts
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
ENV HF_HUB_ENABLE_HF_TRANSFER=1
EXPOSE 7860
CMD ["python", "app.py"]