Skip to content

Commit

Permalink
Backport Dockerfile changes (moveit#3201)
Browse files Browse the repository at this point in the history
... from noetic-devel branch. However, copying sources from docker context for the source build doesn't work due to .dockerignore, which in turn is required for ci and ci-shadow-fixed. (For Noetic, we remove the .dockerignore file for the source build in GHA.)
  • Loading branch information
rhaschke authored Sep 1, 2022
1 parent bb005c2 commit 53d3ea3
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .docker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# MoveIt! Docker Containers
# MoveIt Docker Containers

For more information see [Continuous Integration and Docker](http://moveit.ros.org/documentation/contributing/continuous_integration.html) documentation.
For more information see the pages [Continuous Integration and Docker](http://moveit.ros.org/documentation/contributing/continuous_integration.html) and [Using Docker Containers with MoveIt](https://moveit.ros.org/install/docker/).
2 changes: 1 addition & 1 deletion .docker/ci-shadow-fixed/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Sets up a base image to use for running Continuous Integration on Travis

FROM moveit/moveit:melodic-ci
MAINTAINER Dave Coleman [email protected]
MAINTAINER Robert Haschke [email protected]

# Switch to ros-shadow-fixed
RUN echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` main" | tee /etc/apt/sources.list.d/ros-latest.list
Expand Down
23 changes: 14 additions & 9 deletions .docker/ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,34 @@
# Sets up a base image to use for running Continuous Integration on Travis

FROM ros:melodic-ros-base
MAINTAINER Dave Coleman [email protected]
MAINTAINER Robert Haschke [email protected]

ENV TERM xterm

# Setup (temporary) ROS workspace
WORKDIR /root/ws_moveit

# Copy MoveIt sources from docker context
COPY . src/moveit

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN \
# Update apt package list as previous containers clear the cache
apt-get -qq update && \
apt-get -qq dist-upgrade && \
apt-get -q update && \
apt-get -q -y dist-upgrade && \
#
# Install some base dependencies
apt-get -qq install --no-install-recommends -y \
apt-get -q install --no-install-recommends -y \
# Some basic requirements
wget git sudo \
# Preferred build tools
python-catkin-tools \
python$(test "${ROS_DISTRO}" = "noetic" && echo 3)-catkin-tools \
clang clang-format-10 clang-tidy clang-tools \
ccache && \
#
# Download MoveIt source, so that we can fetch all necessary dependencies
wstool init --shallow src https://raw.githubusercontent.com/ros-planning/moveit/${ROS_DISTRO}-devel/.github/workflows/upstream.rosinstall && \
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit src/moveit && \
# Download MoveIt sources, so that we can fetch all necessary dependencies
wstool init --shallow src src/moveit/.github/workflows/upstream.rosinstall && \
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit_resources src/moveit_resources && \
#
# Download all dependencies of MoveIt
Expand All @@ -38,7 +40,10 @@ RUN \
rm -rf src && \
#
# Clear apt-cache to reduce image size
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
# Globally disable git security
# https://github.blog/2022-04-12-git-security-vulnerability-announced
git config --global --add safe.directory "*"

# Continous Integration Setting
ENV IN_DOCKER 1
5 changes: 3 additions & 2 deletions .docker/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# moveit/moveit:melodic-release
# Full debian-based install of MoveIt! using apt-get
# Full debian-based install of MoveIt using apt-get

FROM ros:melodic-ros-base
MAINTAINER Dave Coleman [email protected]

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
RUN apt-get update && \
RUN apt-get update -q && \
apt-get dist-upgrade -q -y && \
apt-get install -y ros-${ROS_DISTRO}-moveit-* && \
rm -rf /var/lib/apt/lists/*
30 changes: 10 additions & 20 deletions .docker/source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,27 @@
# Downloads the moveit source code and install remaining debian dependencies

FROM moveit/moveit:melodic-ci-shadow-fixed
MAINTAINER Dave Coleman [email protected]
MAINTAINER Robert Haschke [email protected]

ENV PYTHONIOENCODING UTF-8
# Export ROS_UNDERLAY for downstream docker containers
ENV ROS_UNDERLAY /root/ws_moveit/install
WORKDIR $ROS_UNDERLAY/../src
# Environment variable used in instructions on moveit.ros.org website for running clang-tidy
ENV CATKIN_WS $(realpath $ROS_UNDERLAY/..)
WORKDIR $ROS_UNDERLAY/..

# Commands are combined in single RUN statement with "apt/lists" folder removal to reduce image size
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers
RUN \
# Download moveit source so that we can get necessary dependencies
wstool init --shallow . https://raw.githubusercontent.com/ros-planning/moveit/${ROS_DISTRO}-devel/.github/workflows/upstream.rosinstall && \
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit && \
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit_resources && \
# Fetch required upstream sources for building
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit src/moveit && \
git clone --depth 1 --branch ${ROS_DISTRO}-devel https://github.com/ros-planning/moveit_resources src/moveit_resources && \
wstool init --shallow src src/moveit/.github/workflows/upstream.rosinstall && \
#
# Update apt package list as cache is cleared in previous container
# Usually upgrading involves a few packages only (if container builds became out-of-sync)
apt-get -qq update && \
apt-get -qq dist-upgrade && \
#
rosdep update && \
rosdep install -y --from-paths . --ignore-src --rosdistro ${ROS_DISTRO} --as-root=apt:false && \
rm -rf /var/lib/apt/lists/*

ENV PYTHONIOENCODING UTF-8
RUN cd .. && \
catkin config --extend /opt/ros/$ROS_DISTRO --install --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && \
# Status rate is limited so that just enough info is shown to keep Docker from timing out,
# but not too much such that the Docker log gets too long (another form of timeout)
catkin build --limit-status-rate 0.001 --no-notify && \
#
# Update /ros_entrypoint.sh to source our new workspace
sed -i "s#/opt/ros/\$ROS_DISTRO/setup.bash#$ROS_UNDERLAY/setup.sh#g" /ros_entrypoint.sh

# Environment variable used in instructions on moveit.ros.org website for running clang-tidy
ENV CATKIN_WS $(realpath $ROS_UNDERLAY/..)
37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ignore everything
*
# but include these:
!.github/workflows/upstream.rosinstall
!**/package.xml
!**/CATKIN_IGNORE

# https://github.com/moby/moby/issues/42788
!moveit_plugins/moveit_plugins/package.xml
!moveit_plugins/moveit_ros_control_interface/package.xml
!moveit_plugins/moveit_simple_controller_manager/package.xml
!moveit_plugins/moveit_fake_controller_manager/package.xml
!moveit_kinematics/package.xml
!moveit_setup_assistant/package.xml
!moveit_core/package.xml
!moveit_commander/package.xml
!moveit_planners/ompl/package.xml
!moveit_planners/chomp/chomp_motion_planner/package.xml
!moveit_planners/chomp/chomp_interface/package.xml
!moveit_planners/chomp/chomp_optimizer_adapter/package.xml
!moveit_planners/pilz_industrial_motion_planner_testutils/package.xml
!moveit_planners/pilz_industrial_motion_planner/package.xml
!moveit_planners/moveit_planners/package.xml
!moveit_runtime/package.xml
!moveit/package.xml
!moveit_ros/warehouse/package.xml
!moveit_ros/moveit_servo/package.xml
!moveit_ros/occupancy_map_monitor/package.xml
!moveit_ros/perception/package.xml
!moveit_ros/move_group/package.xml
!moveit_ros/robot_interaction/package.xml
!moveit_ros/visualization/package.xml
!moveit_ros/manipulation/package.xml
!moveit_ros/planning/package.xml
!moveit_ros/planning_interface/package.xml
!moveit_ros/benchmarks/package.xml
!moveit_ros/moveit_ros/package.xml

0 comments on commit 53d3ea3

Please sign in to comment.