From cc15ae50b0a56a71f0e68bd774c7c3a55e6165aa Mon Sep 17 00:00:00 2001 From: Josh Whitley Date: Thu, 12 Feb 2026 12:39:42 -0700 Subject: [PATCH] Update Dockerfile and docker-compose to match example_ws --- Dockerfile | 141 ++++---------------------------------------- docker-compose.yaml | 12 +++- 2 files changed, 20 insertions(+), 133 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8a28fcbda..5355ec61a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,8 @@ # # Specify the MoveIt Pro release to build on top of. -ARG MOVEIT_STUDIO_BASE_IMAGE -ARG USERNAME=studio-user +ARG MOVEIT_PRO_BASE_IMAGE=picknikciuser/moveit-studio:${MOVEIT_DOCKER_TAG:-main}-${MOVEIT_ROS_DISTRO:-humble} +ARG USERNAME=moveit-pro-user ARG USER_UID=1000 ARG USER_GID=1000 @@ -16,7 +16,7 @@ ARG USER_GID=1000 ################################################## # The image tag is specified in the argument itself. # hadolint ignore=DL3006 -FROM ${MOVEIT_STUDIO_BASE_IMAGE} AS base +FROM ${MOVEIT_PRO_BASE_IMAGE} AS base # Create a non-root user ARG USERNAME @@ -51,13 +51,17 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ # Add user to video group to enable communication with cameras RUN usermod -aG dialout,video ${USERNAME} +# Add user to the realtime group to enable RT limits +RUN groupadd realtime && \ + usermod -a -G realtime ${USERNAME} + # Install additional dependencies # You can also add any necessary apt-get install, pip install, etc. commands at this point. # NOTE: The /opt/overlay_ws folder contains MoveIt Pro binary packages and the source file. # hadolint ignore=SC1091 RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ - --mount=type=bind,target=${USER_WS}/,source=. \ + --mount=type=bind,target=${USER_WS}/src,source=./src \ . /opt/overlay_ws/install/setup.sh && \ apt-get update && \ rosdep install -q -y \ @@ -94,7 +98,8 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get install -y --no-install-recommends \ less \ gdb \ - nano + nano \ + tmux # Set up the user's .bashrc file and shell. CMD ["/usr/bin/bash"] @@ -113,129 +118,3 @@ WORKDIR $USER_WS # Set up the user's .bashrc file and shell. CMD ["/usr/bin/bash"] - -################################################## -# Starting from the specified MoveIt Pro release with CUDA GPU # -################################################## -# The image tag is specified in the argument itself. -# hadolint ignore=DL3006 -FROM ${MOVEIT_STUDIO_BASE_IMAGE} AS base-gpu - -# Create a non-root user -ARG USERNAME -ARG USER_UID -ARG USER_GID - -# hadolint ignore=DL3008 -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install wget -y -q --no-install-recommends && \ - wget --progress=dot:giga https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb && \ - dpkg -i cuda-keyring_1.1-1_all.deb && \ - apt-get update && \ - apt-get install -q -y --no-install-recommends \ - libcudnn9-cuda-12 \ - libcudnn9-dev-cuda-12 \ - libcublas-12-6 \ - cuda-cudart-12-6 \ - libcurand-12-6 \ - libcufft-12-6 \ - libnvinfer10 \ - libnvinfer-plugin10 \ - libnvonnxparsers10 \ - libtree - -# Misleading name: onnxruntime_gpu is actually specifically the CUDA package. This is only shipped for x86-64 -RUN if [ "$(uname -m)" = "x86_64" ]; then pip3 install --no-cache-dir onnxruntime_gpu==1.19.0; fi - -# Copy source code from the workspace's ROS 2 packages to a workspace inside the container -ARG USER_WS=/home/${USERNAME}/user_ws -ENV USER_WS=${USER_WS} - -# Also mkdir with user permission directories which will be mounted later to avoid docker creating them as root -WORKDIR $USER_WS -# hadolint ignore=DL3008 -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - groupadd --gid $USER_GID ${USERNAME} && \ - useradd --uid $USER_UID --gid $USER_GID --shell /bin/bash --create-home ${USERNAME} && \ - apt-get update && \ - apt-get install -q -y --no-install-recommends sudo && \ - echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} && \ - chmod 0440 /etc/sudoers.d/${USERNAME} && \ - cp -r /etc/skel/. /home/${USERNAME} && \ - mkdir -p \ - /home/${USERNAME}/.ccache \ - /home/${USERNAME}/.config \ - /home/${USERNAME}/.ignition \ - /home/${USERNAME}/.colcon \ - /home/${USERNAME}/.ros && \ - chown -R $USER_UID:$USER_GID /home/${USERNAME} /opt/overlay_ws/ - -# Install additional dependencies -# You can also add any necessary apt-get install, pip install, etc. commands at this point. -# NOTE: The /opt/overlay_ws folder contains MoveIt Pro binary packages and the source file. -# hadolint ignore=SC1091 -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - --mount=type=bind,target=${USER_WS}/,source=. \ - . /opt/overlay_ws/install/setup.sh && \ - apt-get update && \ - rosdep install -q -y \ - --from-paths src \ - --ignore-src - -# Set up colcon defaults for the new user -USER ${USERNAME} -RUN colcon mixin add default \ - https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ - colcon mixin update && \ - colcon metadata add default \ - https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ - colcon metadata update -COPY colcon-defaults.yaml /home/${USERNAME}/.colcon/defaults.yaml - -# hadolint ignore=DL3002 -USER root - -# Set up the user's .bashrc file and shell. -CMD ["/usr/bin/bash"] - -################################################################### -# Target for the developer build which does not compile any code. # -################################################################### -FROM base-gpu AS user-overlay-gpu-dev - -ARG USERNAME -ARG USER_WS=/home/${USERNAME}/user_ws -ENV USER_WS=${USER_WS} - -# Install any additional packages for development work -# hadolint ignore=DL3008 -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - less \ - gdb \ - nano - -# Set up the user's .bashrc file and shell. -CMD ["/usr/bin/bash"] - -######################################### -# Target for compiled, deployable image with GPU support # -######################################### -FROM base-gpu AS user-overlay-gpu - -ARG USERNAME -ARG USER_WS=/home/${USERNAME}/user_ws -ENV USER_WS=${USER_WS} - -ENV LD_LIBRARY_PATH=/usr/local/lib/python3.10/dist-packages/onnxruntime/capi:/usr/lib/x86_64-linux-gnu:/usr/local/cuda-12.6/targets/x86_64-linux/lib:$LD_LIBRARY_PATH - -# Compile the workspace -WORKDIR $USER_WS - -# Set up the user's .bashrc file and shell. -CMD ["/usr/bin/bash"] diff --git a/docker-compose.yaml b/docker-compose.yaml index 9988e5118..ce6e08906 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -3,7 +3,9 @@ # Services that are listed under `/opt/moveit_pro/docker-compose.yaml` are mirrored here for merging. # Feel free to remove services here that are unmodified. +# services: + # The base image that all MoveIt Pro services extend off of. Builds the user workspace. base: {} @@ -11,10 +13,16 @@ services: agent_bridge: {} # Starts the robot drivers. - drivers: {} + drivers: + volumes: + # Allow access to host hardware e.g. RealSense cameras + - /dev:/dev # Starts the web UI frontend. web_ui: {} # Developer specific configuration when running `moveit_pro dev`. - dev: {} + dev: + volumes: + # Allow access to host hardware e.g. RealSense cameras + - /dev:/dev