File size: 3,296 Bytes
3ac20be
6f5050b
3ac20be
 
 
 
 
 
 
48fdabb
 
 
8beeb58
88bb83f
 
48fdabb
6f5050b
3ac20be
6f5050b
3ac20be
 
 
 
 
 
 
8beeb58
3ac20be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f5050b
3ac20be
 
 
 
6f5050b
3ac20be
6f5050b
3ac20be
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8beeb58
 
 
 
 
 
 
 
88bb83f
48fdabb
8beeb58
 
88bb83f
8beeb58
 
6f9e462
 
 
3ac20be
6f9e462
 
8beeb58
 
 
 
 
3ac20be
6f9e462
 
8beeb58
6f9e462
6f5050b
 
 
088e712
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
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"]