commit 3a8765adceeb1be55f8b2794b0ff0d31a501e5c1 Author: Travis Herbranson Date: Thu Apr 30 18:54:39 2026 -0400 InstantMesh Docker deployment — CUDA 12.1, onnxruntime fix, GPU compose diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..c3bbdcb --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,75 @@ +# InstantMesh — single-image to 3D mesh generation +# Based on upstream TencentARC/InstantMesh docker config +# Patched: onnxruntime added, duplicate conda create removed, CUDA aligned +FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 + +LABEL name="instantmesh" maintainer="instantmesh" + +VOLUME /workspace/models + +RUN mkdir -p /workspace/instantmesh +WORKDIR /workspace + +# Timezone +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install -y tzdata && \ + ln -fs /usr/share/zoneinfo/America/Chicago /etc/localtime && \ + dpkg-reconfigure --frontend noninteractive tzdata + +# System dependencies +RUN apt-get update && \ + apt-get install -y build-essential git wget vim libegl1-mesa-dev libglib2.0-0 unzip + +# Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \ + chmod +x Miniconda3-latest-Linux-x86_64.sh && \ + ./Miniconda3-latest-Linux-x86_64.sh -b -p /workspace/miniconda3 && \ + rm Miniconda3-latest-Linux-x86_64.sh + +ENV PATH="/workspace/miniconda3/bin:${PATH}" + +RUN conda init bash + +# Auto-accept conda TOS for non-interactive builds +ENV CONDA_PLUGINS_AUTO_ACCEPT_TOS=true + +# Create conda environment +RUN conda create -n instantmesh python=3.10 && \ + echo "source activate instantmesh" > ~/.bashrc +ENV PATH /workspace/miniconda3/envs/instantmesh/bin:$PATH + +RUN conda install Ninja +RUN conda install cuda -c nvidia/label/cuda-12.1.0 -y + +# PyTorch + friends (matched to CUDA 12.1) +RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121 +RUN pip install xformers==0.0.22.post7 +RUN pip install triton + +WORKDIR /workspace/instantmesh + +# Python dependencies +ADD ./requirements.txt /workspace/instantmesh/requirements.txt + +# 1. Install Ninja (makes CUDA compilation faster and more reliable) +RUN pip install ninja + +# 2. Install most requirements, but skip the problematic ones for a second +# We use a trick to ignore the nvdiffrast line if it's in the file +RUN pip install --no-cache-dir -r requirements.txt || true + +# 3. Manually install nvdiffrast with the magic flag +RUN pip install git+https://github.com/NVlabs/nvdiffrast.git --no-build-isolation + + +#RUN pip install -r requirements.txt + +# Fix upstream issue #175 — onnxruntime not in original requirements +RUN pip install onnxruntime + +COPY . /workspace/instantmesh + +EXPOSE 43839 + +CMD ["python", "app.py"] diff --git a/docker/compose.yml b/docker/compose.yml new file mode 100644 index 0000000..10f3253 --- /dev/null +++ b/docker/compose.yml @@ -0,0 +1,22 @@ +services: + instantmesh: + build: + context: ../InstantMesh + dockerfile: ../docker/Dockerfile + image: instantmesh:local + container_name: instantmesh + ports: + - "43839:43839" + volumes: + - instantmesh-models:/workspace/models + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] + restart: unless-stopped + +volumes: + instantmesh-models: diff --git a/docker/requirements.txt b/docker/requirements.txt new file mode 100644 index 0000000..aa68bbd --- /dev/null +++ b/docker/requirements.txt @@ -0,0 +1,19 @@ +pytorch-lightning==2.1.2 +gradio==3.41.2 +huggingface-hub +einops +omegaconf +torchmetrics +webdataset +accelerate +tensorboard +PyMCubes +trimesh +rembg +transformers==4.34.1 +diffusers==0.20.2 +bitsandbytes +imageio[ffmpeg] +xatlas +plyfile +git+https://github.com/NVlabs/nvdiffrast/ \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..945c01b --- /dev/null +++ b/main.py @@ -0,0 +1,6 @@ +def main(): + print("Hello from instamesh-docker!") + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..312b597 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[project] +name = "instamesh-docker" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.12" +dependencies = []