Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions sim/isaac-uv/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
FROM nvidia/cuda:12.6.3-base-ubuntu22.04

# --- 1. 用户与权限配置 ---
ARG USERNAME=Elaina
ARG USER_UID=1000
ARG USER_GID=1000

RUN groupadd --gid ${USER_GID} ${USERNAME} \
&& useradd --uid ${USER_UID} --gid ${USER_GID} -G root -m -s /usr/local/bin/zsh ${USERNAME} \
&& apt-get update && apt-get install -y sudo \
&& echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
&& rm -rf /var/lib/apt/lists/*
SHELL ["/bin/bash", "-c"]

# --- 2. 环境变量配置 ---
ENV MAMBA_ROOT_PREFIX=/usr/local \
UV_SYSTEM_PYTHON=1 \
ISAACSIM_PATH=/isaac-sim

# --- 3. 安装包管理工具与 GUI 核心依赖 (APT) ---
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates tar bzip2 unzip \
libatomic1 libgomp1 libglib2.0-0 libnghttp2-14 \
libegl1 libgl1 libglu1-mesa libglx0 libsm6 libxi6 libxrandr2 libxt6 \
# 渲染与窗口支持
libvulkan1 vulkan-tools libx11-6 libxau6 libxcb1 libxdmcp6 libxext6 \
&& curl -LsSf https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xj -C /usr/bin/ --strip-components=1 bin/micromamba \
&& apt-get -y autoremove \
#清理中间缓存
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
#给权限!重要
&& chown -R ${USERNAME}:${USER_GID} /usr/local
# --- 合并官方所有驱动配置逻辑 ---
RUN mkdir -p /usr/share/glvnd/egl_vendor.d /etc/vulkan/icd.d /etc/vulkan/implicit_layer.d \
&& printf '{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_nvidia.so.0"}}\n' > /usr/share/glvnd/egl_vendor.d/10_nvidia.json \
&& printf '{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_mesa.so.0"}}\n' > /usr/share/glvnd/egl_vendor.d/50_mesa.json \
&& printf '{"file_format_version":"1.0.0","ICD":{"library_path":"libGLX_nvidia.so.0","api_version":"1.3.194"}}\n' > /etc/vulkan/icd.d/nvidia_icd.json \
&& printf '{"file_format_version":"1.0.0","layer":{"name":"VK_LAYER_NV_optimus","type":"INSTANCE","library_path":"libGLX_nvidia.so.0","api_version":"1.3.194","implementation_version":"1","description":"NVIDIA Optimus layer","functions":{"vkGetInstanceProcAddr":"vk_optimusGetInstanceProcAddr","vkGetDeviceProcAddr":"vk_optimusGetDeviceProcAddr"},"enable_environment":{"__NV_PRIME_RENDER_OFFLOAD":"1"},"disable_environment":{"DISABLE_LAYER_NV_OPTIMUS_1":""}}}\n' > /etc/vulkan/implicit_layer.d/nvidia_layers.json
# --- 合并所有相关的环境变量 ---
ENV NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=all \
VK_DRIVER_FILES=/etc/vulkan/icd.d/nvidia_icd.json
USER ${USERNAME}
# --- 4. Micromamba 强制安装系统级工具 (禁止环境隔离) ---
# 安装 Python 3.11 (Isaac Sim 5.1 必需) 及开发工具到 /usr
RUN micromamba install -y -c conda-forge \
python=3.11 uv\
zsh git wget cmake ninja openssh \
&& micromamba clean --all --yes

# --- 5. 使用 UV 安装 Isaac Sim (前置安装) ---
# 接受 EULA 环境变量 (根据 NVIDIA 要求)
ENV ACCEPT_EULA=Y
USER ${USERNAME}
RUN uv pip install --system --no-cache\
--extra-index-url https://pypi.nvidia.com \
"isaacsim[all,extscache]==5.1.0"

# --- 6. 开发环境配置 (Oh My Zsh & Starship) ---

WORKDIR /home/${USERNAME}

#先安装isaac lab
ENV ISAACLAB_PATH=/home/${USERNAME}/IsaacLab

RUN git clone --depth 1 https://github.com/isaac-sim/IsaacLab.git ${ISAACLAB_PATH} \
&& cd ${ISAACLAB_PATH} \
# 1. 安装核心构建依赖 (注意去掉了多余的 install)
&& uv pip install --system --no-cache "setuptools<82.0.0" \
# 2. 安装内部扩展模块
# 注意:在 Docker 生产/运行镜像中,通常去掉 -e 会更稳定,这里保留以符合你脚本逻辑
&& find "${ISAACLAB_PATH}/source" -mindepth 1 -maxdepth 1 -type d -exec uv pip install --system --no-cache -e "{}" \; \
# 3. 安装 RL 框架支持
&& uv pip install --system --no-cache -e "${ISAACLAB_PATH}/source/isaaclab_rl[sb3,rsl_rl]"


RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended \
&& git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& git clone https://github.com/esc/conda-zsh-completion ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/conda-zsh-completion \
&& sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting conda-zsh-completion)/' ~/.zshrc \
&& curl -sS https://starship.rs/install.sh | sudo sh -s -- -y \
&& echo 'eval "$(starship init zsh)"' >> ~/.zshrc \
&& mkdir -p ~/.config \
&& printf '[username]\nshow_always = true\nstyle_user = "bold #af87ff"\nformat = "[$user]($style) "' > ~/.config/starship.toml


CMD ["/usr/bin/zsh"]
41 changes: 41 additions & 0 deletions sim/isaac-uv/build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# 获取脚本所在目录
# 获取脚本所在目录的绝对路径
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PARENT_DIR=$(dirname "$SCRIPT_DIR")

echo "脚本目录: $SCRIPT_DIR"
echo "父目录: $PARENT_DIR"

# 设置默认 tag
TAG="isaac-uv"

# 从外部传入的 IMAGE_REPO(格式:ghcr.io/user/repo 或 docker.io/user/repo)
IMAGE_REPO="elainasuki/other"

# 组合完整镜像名
IMAGE="$IMAGE_REPO:$TAG"

# 获取工作流中的环境变量来决定是否支持 arm64
PLATFORMS="linux/amd64" # 默认只支持 amd64 架构

if [[ "${BUILD_ARM64}" == "true" ]]; then
PLATFORMS="$PLATFORMS,linux/arm64" # 如果环境变量 BUILD_ARM64 为 true,则支持 arm64 架构
fi
# 这里用的是docker build .. content是上一级而不是当前目录
# 如果传入 --github-action 参数
if [[ "$1" == "--github-action" ]]; then
echo "构建并推送镜像: $IMAGE"
docker buildx build \
--platform $PLATFORMS \
-t "$IMAGE" \
-f "$SCRIPT_DIR/Dockerfile" \
--cache-from "type=registry,ref=$IMAGE" \
--cache-to type=inline \
"$SCRIPT_DIR" \
--push
else
echo "本地构建 $IMAGE"
docker build -t "$IMAGE" -f "$SCRIPT_DIR/Dockerfile" "$SCRIPT_DIR"
fi
3 changes: 2 additions & 1 deletion sim/isaac/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ WORKDIR /home/${USERNAME}
RUN git clone --depth 1 https://github.com/isaac-sim/IsaacLab.git \
&& cd IsaacLab \
&& ln -s /isaac-sim _isaac_sim \
&& ./isaaclab.sh --install rsl_rl sb3
&& ./isaaclab.sh --install rsl_rl sb3 || true


#把/isaac-sim目录权限改为当前用户,给可执行权限
# RUN chown -R ${USERNAME}:${USER_GID} /isaac-sim\
Expand Down
Loading