62 lines
2.2 KiB
Docker
Executable File
62 lines
2.2 KiB
Docker
Executable File
# 使用 devel 镜像,确保有 nvcc + CUDA Toolkit
|
||
FROM nvidia/cuda:12.8.0-devel-ubuntu22.04
|
||
|
||
# 安装基本系统依赖(apt 清理缓存节省空间)
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
wget \
|
||
git \
|
||
build-essential \
|
||
cmake \
|
||
ninja-build \
|
||
libglib2.0-0 \
|
||
libgl1 \
|
||
python3.10 \
|
||
python3.10-dev \
|
||
python3-pip \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 安装 miniconda(推荐用官方最新版)
|
||
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
|
||
bash /tmp/miniconda.sh -b -p /opt/conda && \
|
||
rm /tmp/miniconda.sh && \
|
||
/opt/conda/bin/conda clean --all -y
|
||
|
||
# 把 conda 加到 PATH
|
||
ENV PATH="/opt/conda/bin:${PATH}"
|
||
|
||
# 接受 ToS(关键修复点)
|
||
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
|
||
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
||
#
|
||
## 创建环境
|
||
#RUN conda create -n trellis python=3.10 -y && \
|
||
# echo "conda activate trellis" >> ~/.bashrc
|
||
#
|
||
#SHELL ["/bin/bash", "-c"]
|
||
#
|
||
## 激活环境后安装 PyTorch 2.8 nightly + CUDA 12.8
|
||
#RUN conda activate trellis && \
|
||
# conda install pytorch torchvision torchaudio pytorch-cuda=12.8 -c pytorch-nightly -c nvidia -y
|
||
#
|
||
## 安装 pytorch3d(优先用 fvcore 频道,如果没有则从 git 源码编译)
|
||
#RUN conda activate trellis && \
|
||
# conda install pytorch3d -c fvcore -c pytorch -c nvidia -y || \
|
||
# pip install --no-cache-dir "git+https://github.com/facebookresearch/pytorch3d.git@stable"
|
||
#
|
||
## 如果你有 trellis.tar.gz 打包的环境,可以继续 COPY 并 unpack(可选)
|
||
## COPY trellis.tar.gz /opt/
|
||
## RUN mkdir /opt/env && tar -xzf /opt/trellis.tar.gz -C /opt/env && /opt/env/bin/conda-unpack
|
||
#
|
||
## 安装 kaolin(你的原 Dockerfile 有这个)
|
||
#RUN conda activate trellis && \
|
||
# pip install kaolin==0.18.0 -f https://nvidia-kaolin.s3.us-east-2.amazonaws.com/torch-2.8.0_cu128.html
|
||
|
||
# 设置 PATH 和工作目录
|
||
ENV PATH="/opt/conda/envs/trellis/bin:${PATH}"
|
||
WORKDIR /workspace
|
||
|
||
# 复制你的代码(如果需要)
|
||
COPY . /workspace
|
||
|
||
# 默认命令:保持容器运行,或换成你的启动脚本
|
||
CMD ["tail", "-f", "/dev/null"] |