diff --git a/tests/diff_base/docker/.bashrc b/tests/diff_base/docker/.bashrc index a91c4e83..28a04289 100644 --- a/tests/diff_base/docker/.bashrc +++ b/tests/diff_base/docker/.bashrc @@ -1,4 +1,13 @@ {PLACEHOLDER_MULTILINE} +# Setup paths in `~/.profile` to allow unified environment variable across login/non-login shells +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/bin" ] ; then + PATH="$HOME/bin:$PATH" +fi +# set PATH so it includes user's private bin if it exists +if [ -d "$HOME/.local/bin" ] ; then + PATH="$HOME/.local/bin:$PATH" +fi # Source global ROS2 environment source /opt/ros/$ROS_DISTRO/setup.bash # Optionally perform apt update if it has not been executed yet @@ -10,13 +19,14 @@ fi if [ ! -d $HOME/.ros/rosdep/sources.cache ]; then echo "rosdep update has not been executed yet. Running rosdep update..." rosdep update + cd $ROS2_WS + # Ref: https://docs.ros.org/en/humble/Tutorials/Intermediate/Rosdep.html + rosdep install --from-paths src --ignore-src -y -r fi # Optionally build the workspace if it has not been built yet if [ ! -f $ROS2_WS/install/setup.bash ]; then echo "Workspace has not been built yet. Building workspace..." cd $ROS2_WS - # Ref: https://docs.ros.org/en/humble/Tutorials/Intermediate/Rosdep.html - rosdep install --from-paths src --ignore-src -y -r # TODO: If command `arch` outputs `aarch64`, consider adding `--packages-ignore ` to ignore x86 packages # Ref: https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html if [ $(arch) == "aarch64" ]; then @@ -26,7 +36,17 @@ if [ ! -f $ROS2_WS/install/setup.bash ]; then fi echo "Workspace built." fi +# Source gazebo environment +{PLACEHOLDER_MULTILINE} +# Ref: https://classic.gazebosim.org/tutorials?tut=ros2_installing&cat=connect_ros#InstallGazebo +if [ $(arch) == "x86_64" ]; then + source /usr/share/gazebo/setup.bash +fi # TODO: Source other workspace environments as underlay {PLACEHOLDER_MULTILINE} +# Agree Isaac Sim EULA +# Ref: https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_python.html#running-isaac-sim +export OMNI_KIT_ACCEPT_EULA=YES # Source workspace environment source $ROS2_WS/install/setup.bash +echo "Successfully built workspace and configured environment variables." diff --git a/tests/diff_base/docker/Dockerfile b/tests/diff_base/docker/Dockerfile index 6c9c8594..a9242ee3 100644 --- a/tests/diff_base/docker/Dockerfile +++ b/tests/diff_base/docker/Dockerfile @@ -25,7 +25,7 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloa RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ apt-get update && apt-get upgrade -y \ && rm -rf /var/lib/apt/lists/* -{PLACEHOLDER_MULTILINE} + # Install sudo and create a user with sudo privileges # Ref: https://stackoverflow.com/a/65434659 RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ @@ -57,12 +57,39 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ python3-pip \ && rm -rf /var/lib/apt/lists/* -# Install custom tools +# Install GUI debugging tools +# - `x11-apps` and `x11-utils` for `xeyes` and `xdpyinfo` +# Ref: https://packages.debian.org/sid/x11-apps +# Ref: https://packages.debian.org/sid/x11-utils +# - `mesa-utils` for `glxgears` and `glxinfo` +# Ref: https://wiki.debian.org/Mesa +# - `vulkan-tools` for `vkcube` and `vulkaninfo` +# Ref: https://docs.vulkan.org/tutorial/latest/02_Development_environment.html#_vulkan_packages +# Ref: https://gitlab.com/nvidia/container-images/vulkan/-/blob/master/docker/Dockerfile.ubuntu RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ apt-get update && apt-get install -y \ - git-extras \ + x11-apps x11-utils \ + mesa-utils \ + libgl1 vulkan-tools \ && rm -rf /var/lib/apt/lists/* +# Setup the required capabilities for the container runtime +# Ref: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/docker-specialized.html#driver-capabilities +ENV NVIDIA_VISIBLE_DEVICES=all +ENV NVIDIA_DRIVER_CAPABILITIES=all + +# Install Vulkan config files +# Ref: https://gitlab.com/nvidia/container-images/vulkan +RUN cat > /etc/vulkan/icd.d/nvidia_icd.json <