File size: 1,974 Bytes
e6da863
 
efc2a44
 
 
c179ef4
e6da863
efc2a44
e35ce27
efc2a44
e35ce27
efc2a44
d1fecac
 
 
 
d303c8e
136e069
c179ef4
efc2a44
 
185fd48
 
 
 
 
 
0796c7e
 
185fd48
8be256e
efc2a44
e35ce27
0de805c
 
e6da863
 
0de805c
2b9f9cb
 
 
efc2a44
e6da863
 
 
2b9f9cb
 
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
# Hugging Face Space: Streamlit on port 7860 (required by HF)
FROM python:3.10-slim

WORKDIR /app

# System deps: libxcb for OpenCV/rembg; cmake for torchmcubes; ffmpeg for imageio; xvfb for TripoSR texture baking (ModernGL needs a display)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    curl \
    ffmpeg \
    git \
    libxcb1 \
    libxcb-shm0 \
    libxcb-render0 \
    libxcb-shape0 \
    libxcb-xfixes0 \
    xauth \
    xvfb \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt requirements-docker.txt ./
# Install CPU-only PyTorch first so torchmcubes can build without CUDA (Docker build has no GPU/CUDA).
# If we install default torch (CUDA wheel), CMake fails: "Your installed Caffe2 version uses CUDA but I cannot find CUDA".
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install rest of deps without touching torch/torchvision (requirements-docker.txt omits them)
RUN pip install --no-cache-dir -r requirements-docker.txt
# torchmcubes: build deps for --no-build-isolation (scikit-build-core, pybind11, ninja)
RUN pip install --no-cache-dir scikit-build-core pybind11 ninja
# torchmcubes must be built after torch is installed (CMake needs TorchConfig.cmake); CPU Torch = no CUDA required at build.
RUN pip install --no-cache-dir --no-build-isolation "git+https://github.com/tatsy/torchmcubes.git"

# TripoSR repo (model downloaded at runtime from Hugging Face)
RUN git clone --depth 1 https://github.com/VAST-AI-Research/TripoSR.git TripoSR

COPY app.py .
COPY scripts/ ./scripts/
COPY pages/ ./pages/
COPY .streamlit/ ./.streamlit/
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh

# HF Spaces expose port 7860
EXPOSE 7860
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || true
# Start Xvfb in background then Streamlit (avoids xvfb-run which can hang in HF Spaces)
ENTRYPOINT ["/app/entrypoint.sh"]