evoneuralIn3D-app / Dockerfile
manav0506's picture
Sync deps: Dockerfile system deps + ffmpeg, single pip flow
2b9f9cb
Raw
History Blame Contribute Delete
1.97 kB
# 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"]