-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.runpod
More file actions
159 lines (131 loc) · 5.14 KB
/
Dockerfile.runpod
File metadata and controls
159 lines (131 loc) · 5.14 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Multi-stage Dockerfile for 3DAIGC-API (RunPod Optimized)
FROM nvidia/cuda:12.4.0-devel-ubuntu20.04 AS base
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
ENV TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6 8.9 9.0+PTX"
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
curl \
git \
build-essential \
cmake \
ninja-build \
libgl1-mesa-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libegl1 \
libegl1-mesa \
libgl1-mesa-dev \
libjpeg-dev \
libwebp-dev \
libgles2-mesa-dev \
libosmesa6-dev \
libxi6 \
libxkbcommon-dev \
xvfb \
redis-server \
supervisor \
&& rm -rf /var/lib/apt/lists/*
# Install Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
bash miniconda.sh -b -p /opt/conda && \
rm miniconda.sh
ENV PATH="/opt/conda/bin:${PATH}"
# Initialize conda
RUN conda init bash
# Create conda environment with Python 3.10
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
RUN conda create -n 3daigc-api python=3.10 -y
# Make conda environment activation persistent
SHELL ["conda", "run", "-n", "3daigc-api", "/bin/bash", "-c"]
# Install PyTorch with CUDA 12.4 support
RUN pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu124
# Set working directory
WORKDIR /app
# Copy the entire project
COPY . .
# Setup proxy settings passed via build args
ARG http_proxy
ARG https_proxy
ARG no_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy
ENV no_proxy=$no_proxy
# Install TRELLIS.2 dependencies
WORKDIR /app/thirdparty/TRELLIS.2
RUN bash setup.sh --basic --flash-attn --nvdiffrast --nvdiffrec --cumesh --o-voxel --flexgemm
RUN pip install kaolin -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.6.0_cu124.html
# Install TRELLIS(v1) requirements on top of TRELLIS.2
RUN pip install pymeshfix igraph
RUN git clone https://github.com/autonomousvision/mip-splatting.git /tmp/extensions/mip-splatting && \
pip install /tmp/extensions/mip-splatting/submodules/diff-gaussian-rasterization/ --no-build-isolation && \
rm -rf /tmp/extensions/mip-splatting
# Install PartField dependencies
WORKDIR /app/thirdparty/PartField
RUN pip install lightning==2.2 h5py yacs trimesh scikit-image loguru boto3
RUN pip install mesh2sdf tetgen pymeshlab plyfile einops libigl polyscope potpourri3d simple_parsing arrgh open3d psutil
RUN pip install /app/assets/wheels/torch_scatter-2.1.2+pt26cu124-cp310-cp310-linux_x86_64.whl --no-deps
RUN pip install /app/assets/wheels/torch_sparse-0.6.18+pt26cu124-cp310-cp310-linux_x86_64.whl --no-deps
RUN pip install /app/assets/wheels/torch_cluster-1.6.3+pt26cu124-cp310-cp310-linux_x86_64.whl --no-deps
# Install Hunyuan3D 2.1 dependencies
WORKDIR /app/thirdparty/Hunyuan3D-2.1
RUN cd hy3dpaint/custom_rasterizer && pip install -e . --no-build-isolation
WORKDIR /app/thirdparty/Hunyuan3D-2.1/hy3dpaint/DifferentiableRenderer
RUN pip install pybind11==3.0.1
RUN bash compile_mesh_painter.sh
WORKDIR /app/thirdparty/Hunyuan3D-2.1
RUN pip install -r requirements-inference.txt
# Install UniRig dependencies
WORKDIR /app/thirdparty/UniRig
RUN pip install spconv-cu120 pyrender fast-simplification python-box timm
# Install PartPacker dependencies
WORKDIR /app/thirdparty/PartPacker
RUN pip install pybind11==3.0.1
RUN pip install meshiki kiui fpsample pymcubes einops
# Install PartUV dependencies
RUN pip install seaborn partuv blenderproc
# Install P3-SAM dependencies
WORKDIR /app/thirdparty/Hunyuan3DPart/P3SAM
RUN pip install numba scikit-learn fpsample
# Install FastMesh dependencies
WORKDIR /app/thirdparty/FastMesh
RUN if [ -f "requirement_extra.txt" ]; then pip install -r requirement_extra.txt; fi
# Install UltraShape dependencies
WORKDIR /app/thirdparty/UltraShape
RUN pip install git+https://github.com/ashawkey/cubvh --no-build-isolation
# Install VoxHammer dependencies
WORKDIR /app/thirdparty/VoxHammer
RUN pip install git+https://github.com/huanngzh/bpy-renderer.git
RUN pip install pysdf sentencepiece
# Install main project dependencies
WORKDIR /app
RUN pip install -r requirements.txt
RUN pip install -r requirements-test.txt
RUN pip install huggingface_hub vtk pyvista numpy==1.24.3
# Create necessary directories
RUN mkdir -p /app/uploads /app/data /app/logs /app/outputs
# Setup Supervisor
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Set environment variables for runtime
ENV PYTHONPATH="/app"
ENV CONDA_DEFAULT_ENV=3daigc-api
ENV ENVIRONMENT=production
ENV http_proxy=""
ENV https_proxy=""
ENV no_proxy=""
ENV HTTP_PROXY=""
ENV HTTPS_PROXY=""
ENV NO_PROXY=""
# Expose port for FastAPI
EXPOSE 7842
# Start Supervisor with cleanup of stale files
CMD ["/bin/bash", "-c", "rm -f /var/run/supervisord.pid /var/run/supervisor.sock && exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"]