-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
105 lines (89 loc) · 4.01 KB
/
Dockerfile
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
##############################################################################
## Base Image ##
##############################################################################
ARG ROS_DISTRO=humble
FROM ros:$ROS_DISTRO-ros-base
ENV TZ=Europe/Berlin
ENV TERM=xterm-256color
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Update packages only if necessary, ~250MB
# RUN apt update && apt -y dist-upgrade
##############################################################################
## Global Dependecies ##
##############################################################################
RUN apt-get update && apt-get install --no-install-recommends -y \
python3-pip \
python3-colcon-common-extensions \
gdb \
ros-$ROS_DISTRO-behaviortree-cpp-v3 \
ros-$ROS_DISTRO-nav2-msgs \
qtbase5-dev \
libqt5svg5-dev \
libzmq3-dev \
libdw-dev \
libqt5opengl5-dev \
qttools5-dev-tools \
nano \
ros-$ROS_DISTRO-ur \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install -U pip setuptools
##############################################################################
## Create User ##
##############################################################################
ARG USER=docker
ARG PASSWORD=docker
ARG UID=1000
ARG GID=1000
ENV UID=$UID
ENV GID=$GID
ENV USER=$USER
RUN groupadd -g "$GID" "$USER" && \
useradd -m -u "$UID" -g "$GID" --shell $(which bash) "$USER" -G sudo && \
echo "$USER:$PASSWORD" | chpasswd && \
echo "%sudo ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/sudogrp && \
chmod 0440 /etc/sudoers.d/sudogrp && \
chown ${UID}:${GID} -R /home/${USER}
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> /etc/bash.bashrc
# Set ROS2 DDS profile
COPY neobotix_coordinator/config/dds_profile.xml /home/$USER
RUN chown $USER:$USER /home/$USER/dds_profile.xml
ENV FASTRTPS_DEFAULT_PROFILES_FILE=/home/$USER/dds_profile.xml
USER $USER
RUN mkdir -p /home/$USER/ros2_ws/src
##############################################################################
## User Dependecies ##
##############################################################################
WORKDIR /home/$USER/ros2_ws/src
RUN git clone https://github.com/BehaviorTree/Groot.git
RUN git clone -b humble https://github.com/AndreasZachariae/BehaviorTree.IRAS.git
COPY neobotix_coordinator ./neobotix_coordinator
COPY iras_interfaces ./iras_interfaces
COPY moveit_wrapper ./moveit_wrapper
COPY camera_interfaces ./camera_interfaces
COPY select_table_interfaces ./select_table_interfaces
# Clone private Github repos with ssh key
# USER root
# RUN mkdir -m 700 /root/.ssh && \
# touch -m /root/.ssh/known_hosts && \
# ssh-keyscan github.com > /root/.ssh/known_hosts
# ARG CACHE_BUST
# RUN --mount=type=ssh \
# git clone -b humble git@github.com:IRAS-HKA/object_detector_tensorflow.git
## Not necessary for NEOBOTIX
##RUN git clone -b humble https://github.com/IRAS-HKA/object_detector_tensorflow.git
#RUN mv ./object_detector_tensorflow/ros/object_detector_tensorflow_interfaces . && \
# rm -rf ./object_detector_tensorflow
USER $USER
##############################################################################
## Build ROS and run ##
##############################################################################
WORKDIR /home/$USER/ros2_ws
RUN rosdep update --rosdistro $ROS_DISTRO
RUN rosdep install --from-paths src --ignore-src -y
RUN . /opt/ros/$ROS_DISTRO/setup.sh && colcon build --symlink-install \
--cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
RUN echo "source /home/$USER/ros2_ws/install/setup.bash" >> /home/$USER/.bashrc
RUN sudo sed --in-place --expression \
'$isource "/home/$USER/ros2_ws/install/setup.bash"' \
/ros_entrypoint.sh
CMD /bin/bash