Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward ports recent dockerfile changes on foxy #704

Merged
merged 5 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .docker/ci-testing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-ci-testing
# CI image using the ROS testing repository

ARG ROS_DISTRO=foxy
ARG ROS_DISTRO=rolling
FROM ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-ci

MAINTAINER Dave Coleman dave@picknik.ai
MAINTAINER Robert Haschke rhaschke@techfak.uni-bielefeld.de

# Switch to ros-testing
Expand Down
18 changes: 9 additions & 9 deletions .docker/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-ci
# ROS base image augmented with all MoveIt dependencies to use for CI

ARG ROS_DISTRO=foxy
ARG ROS_DISTRO=rolling
FROM ros:${ROS_DISTRO}-ros-base-focal

MAINTAINER Robert Haschke rhaschke@techfak.uni-bielefeld.de
MAINTAINER Dave Coleman dave@picknik.ai

ENV TERM xterm

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

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

# 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 curl \
# Preferred build tools
clang clang-format-10 clang-tidy clang-tools \
ccache && \
#
# Download MoveIt source, so that we can fetch all necessary dependencies
mkdir src && \
git clone https://github.com/ros-planning/moveit2.git src/moveit2 -b main && \
# Fetch all dependencies from moveit2.repos
vcs import src < src/moveit2/moveit2.repos && \
if [ -r src/moveit2/moveit2_${ROS_DISTRO}.repos ] ; then vcs import src < src/moveit2/moveit2_${ROS_DISTRO}.repos ; fi && \
#
Expand Down
7 changes: 4 additions & 3 deletions .docker/release/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-release
# Full debian-based install of MoveIt using apt-get

ARG ROS_DISTRO=foxy
ARG ROS_DISTRO=rolling
FROM ros:${ROS_DISTRO}-ros-base-focal
MAINTAINER Dave Coleman dave@picknik.ai
MAINTAINER Robert Haschke rhaschke@techfak.uni-bielefeld.de

# 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/*
43 changes: 21 additions & 22 deletions .docker/source/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# syntax = docker/dockerfile:1.3
vatanaksoytezer marked this conversation as resolved.
Show resolved Hide resolved

# ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-source
# Downloads the moveit source code and install remaining debian dependencies

ARG ROS_DISTRO=foxy
ARG ROS_DISTRO=rolling
FROM ghcr.io/ros-planning/moveit2:${ROS_DISTRO}-ci-testing

MAINTAINER Robert Haschke rhaschke@techfak.uni-bielefeld.de
MAINTAINER Dave Coleman dave@picknik.ai

# Export ROS_UNDERLAY for downstream docker containers
ENV ROS_UNDERLAY /root/ws_moveit/install
WORKDIR $ROS_UNDERLAY/../src
WORKDIR $ROS_UNDERLAY/..

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

# 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
git clone https://github.com/ros-planning/moveit2.git -b main && \
vcs import < moveit2/moveit2.repos && \
if [ -r moveit2/moveit2_${ROS_DISTRO}.repos ] ; then vcs import < moveit2/moveit2_${ROS_DISTRO}.repos ; fi && \
RUN --mount=type=cache,target=/root/.ccache/ \
# Enable ccache
PATH=/usr/lib/ccache:$PATH && \
# Fetch required upstream sources for building
vcs import src < src/moveit2/moveit2.repos && \
if [ -r src/moveit2/moveit2_${ROS_DISTRO}.repos ] ; then vcs import src < src/moveit2/moveit2_${ROS_DISTRO}.repos ; fi && \
#
# 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/*

# Build the workspace
RUN cd $ROS_UNDERLAY/.. && . /opt/ros/${ROS_DISTRO}/setup.sh &&\
. /opt/ros/${ROS_DISTRO}/setup.sh &&\
colcon build \
--cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
--ament-cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers desktop_notification- status-
--ament-cmake-args -DCMAKE_BUILD_TYPE=Release \
--event-handlers desktop_notification- status- && \
ccache -s && \
#
# 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
41 changes: 41 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ignore everything
*
# but include these:
!moveit2*.repos
!**/package.xml
!**/COLCON_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_kinematics/package.xml
!moveit_common/package.xml
!moveit_setup_assistant/package.xml
!moveit_core/package.xml
!moveit_commander/package.xml
!moveit_demo_nodes/run_move_group/package.xml
!moveit_demo_nodes/run_ompl_constrained_planning/package.xml
!moveit_demo_nodes/run_moveit_cpp/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_planners/trajopt/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
8 changes: 7 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
steps:
- name: Check for apt updates
uses: addnab/docker-run-action@v3
continue-on-error: true
id: apt
with:
image: ${{ env.GH_IMAGE }}
Expand Down Expand Up @@ -77,6 +78,7 @@ jobs:
steps:
- name: Check for apt updates
uses: addnab/docker-run-action@v3
continue-on-error: true
id: apt
with:
image: ${{ env.GH_IMAGE }}
Expand Down Expand Up @@ -129,6 +131,7 @@ jobs:
steps:
- name: Check for apt updates
uses: addnab/docker-run-action@v3
continue-on-error: true
id: apt
with:
image: ${{ env.GH_IMAGE }}
Expand Down Expand Up @@ -179,6 +182,7 @@ jobs:
DH_IMAGE: moveit/moveit2:${{ matrix.ROS_DISTRO }}-${{ github.job }}

steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Containter Registry
Expand All @@ -192,15 +196,17 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Remove .dockerignore"
run: rm .dockerignore # enforce full source context
- name: Build and Push
uses: docker/build-push-action@v2
with:
context: .
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's neat, thanks @rhaschke

file: .docker/${{ github.job }}/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
push: true
cache-from: type=registry,ref=${{ env.GH_IMAGE }}
cache-to: type=inline
no-cache: true
tags: |
${{ env.GH_IMAGE }}
${{ env.DH_IMAGE }}