This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile.humble.core
144 lines (128 loc) · 5.52 KB
/
Dockerfile.humble.core
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
ARG BASE_IMAGE=rbonghi/isaac-ros-base:devel
FROM ${BASE_IMAGE}
# ROS distributions
# https://discourse.ros.org/t/core-base-and-desktop-releases/20267
ARG ROS_PKG=ros_core
ENV ROS_DISTRO=humble
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
# ROS2 Humble installation
# https://docs.ros.org/en/humble/Installation/Alternatives/Ubuntu-Development-Setup.html
# Add ROS2 apt repository
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null
# install development packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-colcon-common-extensions \
python3-flake8 \
python3-flake8-docstrings \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
python3-rosinstall-generator \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
# Python dependencies
&& python3 -m pip install -U \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
setuptools
############################################################
# Avoid setup.py and easy_install deprecation warnings caused by colcon and setuptools
# https://github.com/colcon/colcon-core/issues/454
ENV PYTHONWARNINGS=ignore:::setuptools.command.install,ignore:::setuptools.command.easy_install,ignore:::pkg_resources
# RUN echo "Warning: Using the PYTHONWARNINGS environment variable to silence setup.py and easy_install deprecation warnings caused by colcon"
# download/build ROS from source
RUN mkdir -p ${ROS_ROOT}/src \
&& cd ${ROS_ROOT} \
&& rosinstall_generator --deps --rosdistro ${ROS_DISTRO} ${ROS_PKG} \
launch_xml \
launch_yaml \
launch_testing \
launch_testing_ament_cmake \
demo_nodes_cpp \
demo_nodes_py \
example_interfaces \
camera_calibration_parsers \
camera_info_manager \
cv_bridge \
v4l2_camera \
diagnostic_updater \
vision_opencv \
vision_msgs \
sensor_msgs \
image_geometry \
image_pipeline \
image_transport \
image_transport_plugins \
compressed_image_transport \
compressed_depth_image_transport \
angles \
resource_retriever \
bondcpp \
> ros2.${ROS_DISTRO}.${ROS_PKG}.rosinstall \
&& cat ros2.${ROS_DISTRO}.${ROS_PKG}.rosinstall \
&& vcs import src < ros2.${ROS_DISTRO}.${ROS_PKG}.rosinstall \
&& rm ${ROS_ROOT}/*.rosinstall \
# Adding negotiated
&& git -C ${ROS_ROOT}/src/ clone https://github.com/osrf/negotiated -b master \
# Install dependencies using rosdep
&& apt-get update \
&& rosdep init \
&& rosdep update \
&& rosdep install -y \
--ignore-src \
--from-paths src \
--rosdistro ${ROS_DISTRO} \
--skip-keys "fastcdr rti-connext-dds-6.0.1 urdfdom_headers libopencv-dev libopencv-contrib-dev libopencv-imgproc-dev python-opencv python3-opencv" \
&& rm -Rf /var/lib/apt/lists/* \
&& apt-get clean \
# Build ROS2 source
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to-regex negotiated* \
&& colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& rm -Rf src build log
# Alias setup.bash for consistency with pre-built binary installations of ROS2
RUN echo "source /opt/ros/${ROS_DISTRO}/install/setup.bash ; export ROS_DISTRO=${ROS_DISTRO}" > /opt/ros/${ROS_DISTRO}/setup.bash
############################################################
# Default Humble DDS middleware: FastRTPS
ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp
# setup entrypoint
COPY scripts/ros_entrypoint.sh /ros_entrypoint.sh
RUN sed -i \
's/ros_env_setup="\/opt\/ros\/$ROS_DISTRO\/setup.bash"/ros_env_setup="${ROS_ROOT}\/install\/setup.bash"/g' \
/ros_entrypoint.sh && \
cat /ros_entrypoint.sh
RUN echo 'source ${ROS_ROOT}/install/setup.bash' >> /root/.bashrc
WORKDIR /
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["bash"]