Skip to content
Snippets Groups Projects
Commit 96a08878 authored by ruffsl's avatar ruffsl
Browse files

Stage from osrf/ros2:source Dockerfile

parent e16ec48e
No related branches found
No related tags found
No related merge requests found
# This dockerfile expects proxies to be set via --build-arg if needed
# It also expects to be contained in the /navigation2 root folder for file copy
#
# Example build command:
# export CMAKE_BUILD_TYPE=Debug
#
# This determines which version of the ROS2 code base to pull
# export ROS2_BRANCH=master
#
# This determines which ros2 docker image to use as a base for getting ros2_dependencies
# The latest (osrf/ros2:nightly) is usually the best choice unless a dependency
# has been removed that an older codebase depends on. In those cases, using
# ros:DISTRO-ros-core would be a good choice where distro is crystal, dashing, etc.
# export ROS2_DOCKER_IMAGE=osrf/ros2:nightly
# docker build -t nav2:full_ros_build
# --build-arg CMAKE_BUILD_TYPE \
# -f Dockerfile.full_ros_build ./
# We're only building on top of a ROS docker image to get the basics
# prerequisites installed such as the apt source, rosdep, etc. We don't want to
# actually use any of the ros dashing packages. Instead we are going to build
# everything from source in one big workspace.
ARG FROM_IMAGE=osrf/ros2:nightly
ARG FROM_IMAGE=osrf/ros2:devel
FROM $FROM_IMAGE
# install ROS2 dependencies
# install packages
RUN apt-get update && apt-get install -q -y \
wget \
libasio-dev \
libasio-dev \
libtinyxml2-dev \
wget \
&& rm -rf /var/lib/apt/lists/*
# setup directory structure
ENV ROS2_WS /opt/ros2_ws
RUN mkdir -p $ROS2_WS/src
WORKDIR $ROS2_WS
# clone ROS 2 packages
ARG ROS_DISTRO=dashing
ENV ROS_DISTRO=$ROS_DISTRO
ENV ROS_VERSION=2 \
ROS_PYTHON_VERSION=3
ARG ROS2_BRANCH=master
RUN wget https://raw.githubusercontent.com/ros2/ros2/$ROS2_BRANCH/ros2.repos
RUN vcs import src < ros2.repos
# copy nav 2 source code
ENV NAV2_DIR $ROS2_WS/src/navigation2
COPY ./ src/navigation2/
WORKDIR $ROS2_WS
# clone dependency package repos
ENV NAV2_DEPS_DIR $ROS2_WS/src/navigation2_dependencies
RUN mkdir -p $NAV2_DEPS_DIR
RUN vcs import src < $NAV2_DIR/tools/ros2_dependencies.repos
RUN wget https://raw.githubusercontent.com/ros2/ros2/$ROS_DISTRO-release/ros2.repos \
&& vcs import src < ros2.repos
# install package dependencies
RUN apt-get update && \
rosdep install -q -y \
--from-paths \
$ROS2_WS/src \
src \
--ignore-src --skip-keys rti-connext-dds-5.3.1 \
# install dependencies
RUN apt-get update && rosdep install -y \
--from-paths src \
--ignore-src \
--skip-keys "console_bridge fastcdr fastrtps libopensplice67 libopensplice69 rti-connext-dds-5.3.1 urdfdom_headers" \
&& rm -rf /var/lib/apt/lists/*
# build entire workspace
ARG CMAKE_BUILD_TYPE=Debug
RUN colcon build \
--symlink-install \
--cmake-args \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
# build source
RUN colcon \
build \
--symlink-install \
--mixin build-testing-on release \
--cmake-args --no-warn-unused-cli
ARG RUN_TESTS
ARG FAIL_ON_TEST_FAILURE
RUN if [ ! -z "$RUN_TESTS" ]; then \
colcon test; \
if [ ! -z "$FAIL_ON_TEST_FAILURE" ]; then \
colcon test-result; \
else \
colcon test-result || true; \
fi \
fi
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment