forked from unitreerobotics/unitree_sim_isaaclab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
124 lines (93 loc) · 4.24 KB
/
Dockerfile
File metadata and controls
124 lines (93 loc) · 4.24 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
# ==============================
# Stage 1: Builder
# ==============================
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
ENV CONDA_DIR=/opt/conda
ENV PATH=$CONDA_DIR/bin:$PATH
# 设置 HTTP/HTTPS 代理(可选)
ARG http_proxy
ARG https_proxy
ENV http_proxy=${http_proxy}
ENV https_proxy=${https_proxy}
# 使用阿里云源
RUN sed -i 's|http://archive.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list && \
sed -i 's|http://security.ubuntu.com/ubuntu/|http://mirrors.aliyun.com/ubuntu/|g' /etc/apt/sources.list
# 安装构建依赖(GCC 12 + GLU + Vulkan)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-12 g++-12 cmake build-essential unzip git-lfs \
libglu1-mesa-dev vulkan-tools wget\
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
&& rm -rf /var/lib/apt/lists/*
# 安装 Miniconda
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
bash miniconda.sh -b -p $CONDA_DIR && \
rm miniconda.sh && \
$CONDA_DIR/bin/conda clean -afy
# 接受 Conda 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 && \
conda create -n unitree_sim_env python=3.11 -y && \
conda clean -afy
# 切换到 Conda 环境
SHELL ["conda", "run", "-n", "unitree_sim_env", "/bin/bash", "-c"]
RUN conda install -y -c conda-forge "libgcc-ng>=12" "libstdcxx-ng>=12" && \
apt-get update && apt-get install -y libvulkan1 vulkan-tools && rm -rf /var/lib/apt/lists/*
# 安装 PyTorch(CUDA 12.6 对应)
RUN pip install --upgrade pip && \
pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu126
# 安装 Isaac Sim
RUN pip install "isaacsim[all,extscache]==5.0.0" --extra-index-url https://pypi.nvidia.com
# 创建工作目录
RUN mkdir -p /home/code
WORKDIR /home/code
# 克隆并安装 IsaacLab
RUN git clone https://github.com/isaac-sim/IsaacLab.git && \
cd IsaacLab && \
git checkout v2.2.0 && \
./isaaclab.sh --install
# 构建 CycloneDDS
RUN git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x /cyclonedds && \
cd /cyclonedds && mkdir build install && cd build && \
cmake .. -DCMAKE_INSTALL_PREFIX=../install && \
cmake --build . --target install
# 设置 CycloneDDS 环境变量
ENV CYCLONEDDS_HOME=/cyclonedds/install
# 安装 unitree_sdk2_python
RUN git clone https://github.com/unitreerobotics/unitree_sdk2_python && \
cd unitree_sdk2_python && pip install -e .
# 克隆 unitree_sim_isaaclab
RUN git clone https://github.com/unitreerobotics/unitree_sim_isaaclab.git /home/code/unitree_sim_isaaclab && \
cd /home/code/unitree_sim_isaaclab && pip install -r requirements.txt
# ==============================
# Stage 2: Runtime
# ==============================
FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS runtime
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai
ENV CONDA_DIR=/opt/conda
ENV PATH=$CONDA_DIR/bin:$PATH
# 禁止 Isaac Sim 自动启动
ENV OMNI_KIT_ALLOW_ROOT=1
ENV OMNI_KIT_DISABLE_STARTUP=1
# 安装运行时依赖
RUN apt-get update && apt-get install -y --no-install-recommends \
libglu1-mesa git-lfs zenity unzip \
&& rm -rf /var/lib/apt/lists/*
# 复制 Conda 环境和代码
COPY --from=builder /home/code/IsaacLab /home/code/IsaacLab
COPY --from=builder /home/code/unitree_sdk2_python /home/code/unitree_sdk2_python
COPY --from=builder /cyclonedds /cyclonedds
COPY --from=builder /opt/conda /opt/conda
COPY --from=builder /home/code/unitree_sim_isaaclab /home/code/unitree_sim_isaaclab
ENV CYCLONEDDS_HOME=/cyclonedds/install
# 写入 bashrc 初始化
RUN echo 'source /opt/conda/etc/profile.d/conda.sh' >> ~/.bashrc && \
echo 'conda activate unitree_sim_env' >> ~/.bashrc && \
echo 'export OMNI_KIT_ALLOW_ROOT=1' >> ~/.bashrc && \
echo 'export OMNI_KIT_DISABLE_STARTUP=1' >> ~/.bashrc
WORKDIR /home/code
# 默认进入 Conda 环境 bash
CMD ["conda", "run", "-n", "unitree_sim_env", "/bin/bash"]