FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV PYOPENGL_PLATFORM=egl 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="8.9" ENV CUDAARCHS="89" ENV FORCE_CUDA=1 ENV MAX_JOBS=1 ENV CMAKE_BUILD_PARALLEL_LEVEL=1 ENV TORCH_EXTENSIONS_DIR=/workspace/torch_extensions WORKDIR /workspace RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ git-lfs \ wget \ curl \ unzip \ vim \ cmake \ pkg-config \ ninja-build \ python3-dev \ python3-setuptools \ libeigen3-dev \ libcgal-dev \ libegl1-mesa-dev \ libglib2.0-0 \ libglvnd0 \ libgl1 \ libglx0 \ libegl1 \ libgles2 \ libglvnd-dev \ libgl1-mesa-dev \ libgles2-mesa-dev \ mesa-utils-extra \ libxrender1 \ libxi6 \ libgconf-2-4 \ libxkbcommon-x11-0 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* 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}" SHELL ["/bin/bash", "-lc"] RUN conda tos accept --channel https://repo.anaconda.com/pkgs/main || true && \ conda tos accept --channel https://repo.anaconda.com/pkgs/r || true && \ conda create -n hunyuan3d21 python=3.10 -y ENV PATH="/workspace/miniconda3/envs/hunyuan3d21/bin:${PATH}" ENV LD_LIBRARY_PATH="/workspace/miniconda3/envs/hunyuan3d21/lib:${LD_LIBRARY_PATH}" RUN conda install -n hunyuan3d21 -c nvidia/label/cuda-12.4.1 cuda -y && \ conda install -n hunyuan3d21 -c conda-forge libstdcxx-ng ninja -y RUN pip install --upgrade pip setuptools wheel && \ pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124 RUN git lfs install && \ git clone https://github.com/Tencent-Hunyuan/Hunyuan3D-2.1.git WORKDIR /workspace/Hunyuan3D-2.1 RUN grep -v '^bpy==' requirements.txt > /tmp/hunyuan_requirements_no_bpy.txt && \ pip install -r /tmp/hunyuan_requirements_no_bpy.txt RUN python - <<'PY' import torch print("Torch:", torch.__version__) print("CUDA available:", torch.cuda.is_available()) print("CUDA:", torch.version.cuda) PY RUN cd hy3dpaint/custom_rasterizer && \ MAX_JOBS=1 CUDAARCHS=89 TORCH_CUDA_ARCH_LIST="8.9" \ pip install --no-build-isolation --no-cache-dir . RUN cd hy3dpaint/DifferentiableRenderer && \ MAX_JOBS=1 CUDAARCHS=89 TORCH_CUDA_ARCH_LIST="8.9" \ bash compile_mesh_painter.sh RUN cat > /workspace/health_server.py <<'PY' from fastapi import FastAPI app = FastAPI() @app.get("/") def root(): return { "status": "stage-2-healthy", "service": "hunyuan3d-build-check", "message": "Stage 2 native Hunyuan build layers completed." } @app.get("/health") def health(): return {"status": "healthy", "stage": 2} PY EXPOSE 7860 CMD ["bash", "-lc", "cd /workspace && uvicorn health_server:app --host 0.0.0.0 --port 7860"]