diff --git a/sim/isaac/Dockerfile b/sim/isaac/Dockerfile new file mode 100644 index 0000000..a57d530 --- /dev/null +++ b/sim/isaac/Dockerfile @@ -0,0 +1,51 @@ +FROM nvcr.io/nvidia/isaac-sim:5.1.0 +USER root +# --- 参数与环境变量配置 --- +# 1. 合并所有构建参数 (ARG) +ARG USERNAME=Elaina \ + USER_UID=1000 \ + USER_GID=1000 +# 2. 合并所有环境变量 (ENV) +ENV MAMBA_ROOT_PREFIX=/opt/conda \ + PATH=/opt/conda/bin:$PATH \ + UV_SYSTEM_PYTHON=1 +RUN apt-get update && apt-get install -y --no-install-recommends \ + zsh sudo ca-certificates bzip2 ninja-build openssh-client cmake git wget\ + && curl -LsSf https://astral.sh/uv/install.sh | sh \ + && rm -rf /var/lib/apt/lists/* +RUN wget -qO /usr/bin/micromamba https://github.com/mamba-org/micromamba-releases/releases/latest/download/micromamba-linux-64 \ + && chmod +x /usr/bin/micromamba +#增加用户 +RUN usermod -l ${USERNAME} ubuntu \ + && groupmod -n ${USERNAME} ubuntu \ + && usermod -d /home/${USERNAME} -m ${USERNAME} \ + && chsh -s /usr/bin/zsh ${USERNAME} \ + && echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ + && mkdir -p ${MAMBA_ROOT_PREFIX} \ + && chown -R ${USERNAME}:${USER_GID} ${MAMBA_ROOT_PREFIX} +# 6. 安装 Oh My Zsh & Starship (提升开发体验) +USER ${USERNAME} +WORKDIR /home/$USERNAME +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 +# 安装issac lab +ENV ISAACSIM_PATH=/isaac-sim \ + ISAACSIM_PYTHON_EXE=/isaac-sim/python.sh\ + TERM=xterm +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 + +#把/isaac-sim目录权限改为当前用户,给可执行权限 +# RUN chown -R ${USERNAME}:${USER_GID} /isaac-sim\ +# && chmod -R 775 /isaac-sim +CMD ["/usr/bin/zsh"] \ No newline at end of file diff --git a/sim/isaac/build.bash b/sim/isaac/build.bash new file mode 100755 index 0000000..ef56af3 --- /dev/null +++ b/sim/isaac/build.bash @@ -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" + +# 从外部传入的 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 \ No newline at end of file diff --git a/mujoco/Dockerfile b/sim/mujoco/Dockerfile similarity index 100% rename from mujoco/Dockerfile rename to sim/mujoco/Dockerfile diff --git a/mujoco/build.bash b/sim/mujoco/build.bash similarity index 100% rename from mujoco/build.bash rename to sim/mujoco/build.bash