76 lines
2.3 KiB
Docker
76 lines
2.3 KiB
Docker
# 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"]
|