File size: 1,310 Bytes
dd7afda
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# 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"]