InstantMesh / Dockerfile
Arcapollo's picture
Use Docker SDK: install nvdiffrast with --no-build-isolation in a separate RUN; bind Gradio to 0.0.0.0.
dd7afda
Raw History Blame Contribute Delete
1.31 kB
# Hugging Face Space (Docker SDK). nvdiffrast must be installed with
# `pip install --no-build-isolation` after PyTorch is present; the Gradio builder
# cannot express that when merging requirements with extra CLI packages.
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel
RUN apt-get update && apt-get install -y \
git \
git-lfs \
ffmpeg \
libsm6 \
libxext6 \
cmake \
rsync \
libgl1 \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
WORKDIR /home/user/app
COPY --chown=1000:1000 . .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir ninja setuptools wheel && \
pip install --no-cache-dir --no-build-isolation "git+https://github.com/NVlabs/nvdiffrast.git" && \
pip install --no-cache-dir \
datasets \
"huggingface-hub>=0.30" \
"hf-transfer>=0.1.4" \
"protobuf<4" \
"click<8.1" && \
pip install --no-cache-dir -r requirements-space.txt && \
pip install --no-cache-dir \
"gradio[oauth]==4.26.0" \
"uvicorn>=0.14.0" \
"websockets>=10.4" \
spaces==0.48.1 \
"fastapi<0.113.0"
EXPOSE 7860
CMD ["python", "app.py"]