@@ -24,6 +24,8 @@ ARG SPACE_ROS_IMAGE=osrf/space-ros:latest
2424
2525FROM ${SPACE_ROS_IMAGE}
2626
27+ SHELL ["bash" , "-c" ]
28+
2729# Define arguments used in the metadata definition
2830ARG VCS_REF
2931ARG VERSION="preview"
@@ -41,12 +43,9 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
4143# Disable prompting during package installation
4244ARG DEBIAN_FRONTEND=noninteractive
4345
44- # Clone all space-ros sources
45- RUN mkdir ${SPACEROS_DIR}/src \
46- && vcs import ${SPACEROS_DIR}/src < ${SPACEROS_DIR}/exact.repos
47-
4846# Define key locations
49- ENV MOVEIT2_DIR=${HOME_DIR}/moveit2
47+ ENV MOVEIT2_DIR=${HOME}/moveit2
48+ ENV SPACEROS_WS=${HOME}/spaceros
5049
5150# Make sure the latest versions of packages are installed
5251# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
@@ -57,7 +56,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5756RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5857 --mount=type=cache,target=/var/lib/apt,sharing=locked \
5958 sudo apt-get dist-upgrade -y
60- RUN rosdep update
59+ RUN sudo rosdep init && rosdep update
6160
6261# Install the various build and test tools
6362RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
@@ -92,15 +91,14 @@ RUN python3 -m pip install -U \
9291 pytest-rerunfailures \
9392 pytest
9493
95- # Get the MoveIt2 source code
96- WORKDIR ${HOME_DIR}
97- RUN sudo git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO} moveit2/src
98- RUN cd ${MOVEIT2_DIR}/src \
99- && sudo git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}
94+ # Clone all space-ros sources
95+ RUN mkdir -p ${SPACEROS_WS}/src \
96+ && vcs import ${SPACEROS_WS}/src < ${SPACEROS_DIR}/scripts/spaceros.repos
10097
101- # Update the ownership of the source files (had to use sudo above to work around
102- # a possible inherited 'insteadof' from the host that forces use of ssh
103- RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
98+ # Get the MoveIt2 source code
99+ WORKDIR ${MOVEIT2_DIR}/src
100+ RUN git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO}
101+ RUN git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}
104102
105103# Get rosinstall_generator
106104RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
@@ -113,33 +111,29 @@ COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
113111RUN rosinstall_generator \
114112 --rosdistro ${ROS_DISTRO} \
115113 --deps \
116- --exclude-path ${SPACEROS_DIR}/src \
114+ --exclude-path ${SPACEROS_WS}/ \
117115 --exclude $(cat /tmp/excluded-pkgs.txt) -- \
118116 -- $(cat /tmp/moveit2-pkgs.txt) \
119117 > /tmp/moveit2_generated_pkgs.repos
120118
121119# Get the repositories required by MoveIt2, but not included in Space ROS
122120WORKDIR ${MOVEIT2_DIR}
123121RUN vcs import src < /tmp/moveit2_generated_pkgs.repos
124- COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/
122+ COPY moveit2_tutorials.repos /tmp/
125123RUN vcs import src < /tmp/moveit2_tutorials.repos
126124
127- # Update the ownership of the source files (had to use sudo above to work around
128- # a possible inherited 'insteadof' from the host that forces use of ssh
129- RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
130-
131125# Install system dependencies
132126RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
133127 --mount=type=cache,target=/var/lib/apt,sharing=locked \
134- /bin/bash -c 'source ${SPACEROS_DIR}/install/ setup.bash' \
135- && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py"
128+ /bin/bash -c 'source ${SPACEROS_DIR}/setup.bash' \
129+ && rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -r -y --skip-keys "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py"
136130
137131# Apply a patch to octomap_msgs to work around a build issue
138132COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs
139133RUN cd src/octomap_msgs && git apply octomap_fix.diff
140134
141135# Build MoveIt2
142- RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/ setup.bash \
136+ RUN /bin/bash -c 'source ${SPACEROS_DIR}/setup.bash \
143137 && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'
144138
145139# Add a couple sample GUI apps for testing
0 commit comments