forked from diegoferigo/development-iit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
200 lines (177 loc) · 7.05 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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
ARG from=diegoferigo/tools:latest
FROM ${from}
# ========================
# Install ROS Desktop Full
# ========================
# Get gazebo from the osrf repo
ARG GAZEBO_VER=11
RUN echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" \
> /etc/apt/sources.list.d/gazebo-stable.list &&\
wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - &&\
apt-get update &&\
apt-get install --no-install-recommends -y \
gazebo${GAZEBO_VER} \
libgazebo${GAZEBO_VER}-dev \
&&\
rm -rf /var/lib/apt/lists/*
# https://github.com/osrf/docker_images/blob/master/ros/
ENV ROS_DISTRO melodic
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 &&\
echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -cs` main" \
> /etc/apt/sources.list.d/ros-latest.list
RUN apt-get update &&\
apt-get install --no-install-recommends -y \
python-rosdep \
python-rosinstall \
python-vcstools \
&&\
rm -rf /var/lib/apt/lists/* &&\
rosdep init &&\
rosdep update
RUN apt-get update &&\
apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-desktop \
# ros-${ROS_DISTRO}-desktop-full \
#ros-${ROS_DISTRO}-fake-localization \
#ros-${ROS_DISTRO}-map-server \#
&&\
rm -rf /var/lib/apt/lists/*
# ===========================
# Install libraries and tools
# ===========================
RUN apt-get update &&\
apt-get install -y --no-install-recommends \
# SUPERBUILD
libeigen3-dev \
coinor-libipopt-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libtinyxml-dev \
libedit-dev \
libace-dev \
libgsl0-dev \
libopencv-dev \
libode-dev \
liblua5.1-dev \
lua5.1 \
qtbase5-dev \
qtdeclarative5-dev \
qtmultimedia5-dev \
qml-module-qtquick2 \
qml-module-qtquick-window2 \
qml-module-qtmultimedia \
qml-module-qtquick-dialogs \
qml-module-qtquick-controls \
qml-module-qt-labs-folderlistmodel \
qml-module-qt-labs-settings \
libsdl1.2-dev \
libxml2-dev \
libv4l-dev \
# SIMMECHANICS-TO-URDF
python-lxml \
python-yaml \
python-numpy \
python-setuptools \
# BLOCKFACTORY
libmatio-dev \
# MISC
liboctave-dev \
libqt5opengl5-dev \
libasio-dev &&\
rm -rf /var/lib/apt/lists/*
# ===========================================
# Install YARP, iCub and friends from sources
# ===========================================
# Environment setup of the robotology repositories
# ------------------------------------------------
ENV IIT_DIR=/iit
ENV IIT_INSTALL=${IIT_DIR}/local
ENV IIT_SOURCES=${IIT_DIR}/sources
ARG IIT_BIN=${IIT_INSTALL}/bin
# Download all sources with git
# -----------------------------
# Use docker cache for steps above
ARG IIT_DOCKER_SOURCES="20200518"
RUN mkdir -p ${IIT_SOURCES} &&\
cd ${IIT_SOURCES} &&\
git clone https://github.com/ros/urdf_parser_py &&\
git clone https://github.com/robotology/simmechanics-to-urdf.git &&\
git clone https://github.com/robotology-playground/icub-model-generator.git &&\
git clone https://github.com/robotology/robotology-superbuild.git &&\
chgrp -R runtimeusers ${IIT_DIR} && chmod -R g+rw ${IIT_DIR}
# Env variables for configuring the sources
# -----------------------------------------
ENV CMAKE_GENERATOR=Ninja
ENV SOURCES_BUILD_TYPE=RelWithDebInfo
# Select the main development robot (model loading)
ENV YARP_ROBOT_NAME="iCubGazeboV2_5"
# Configure the MEX provider
# For the time being, ROBOTOLOGY_USES_MATLAB=ON is not supported.
# Refer to https://github.com/diegoferigo/dockerfiles/issues/8
ENV ROBOTOLOGY_USES_OCTAVE=ON
ENV ROBOTOLOGY_USES_MATLAB=OFF
# ENV ROBOTOLOGY_GENERATE_MEX=ON
# Build all sources
# -----------------
# ROBOTOLOGY-SUPERBUILD
EXPOSE 10000/tcp
ENV YARP_COLORED_OUTPUT=1
RUN cd ${IIT_SOURCES}/robotology-superbuild &&\
mkdir -p build && cd build &&\
cmake \
-G $CMAKE_GENERATOR \
-DROBOTOLOGY_ENABLE_CORE:BOOL=ON \
-DROBOTOLOGY_ENABLE_DYNAMICS:BOOL=ON \
-DROBOTOLOGY_ENABLE_ROBOT_TESTING:BOOL=ON \
-DROBOTOLOGY_ENABLE_HUMAN_DYNAMICS:BOOL=ON \
-DROBOTOLOGY_USES_GAZEBO:BOOL=ON \
-DROBOTOLOGY_USES_PYTHON:BOOL=ON \
-DROBOTOLOGY_USES_OCTAVE:BOOL=${ROBOTOLOGY_USES_OCTAVE} \
-DROBOTOLOGY_USES_MATLAB:BOOL=${ROBOTOLOGY_USES_MATLAB} \
-DNON_INTERACTIVE_BUILD:BOOL=ON \
.. &&\
cmake --build . -- $CMAKE_EXTRA_OPTIONS &&\
ln -s ${IIT_SOURCES}/robotology-superbuild/build/install ${IIT_INSTALL} &&\
echo "source ${IIT_INSTALL}/share/robotology-superbuild/setup.sh" >> /etc/bash.bashrc &&\
ln -s ${IIT_SOURCES}/robotology-superbuild/robotology/YARP/scripts/yarp_completion /etc/bash_completion.d/yarp_completion &&\
find ${IIT_SOURCES}/robotology-superbuild -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+
# SIMMECHANICS-TO-URDF
RUN cd ${IIT_SOURCES}/urdf_parser_py &&\
# https://github.com/robotology/icub-model-generator/blob/master/.travis.yml#L56
git checkout 31474b9baaf7c3845b40e5a9aa87d5900a2282c3 &&\
python setup.py install &&\
# Project
cd ${IIT_SOURCES}/simmechanics-to-urdf &&\
python setup.py install &&\
find ${IIT_SOURCES}/urdf_parser_py -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+ &&\
find ${IIT_SOURCES}/simmechanics-to-urdf -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+ &&\
find ${IIT_INSTALL} -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+
# ICUB-MODEL-GENERATOR
RUN cd ${IIT_SOURCES}/icub-model-generator &&\
mkdir -p build && cd build &&\
CMAKE_PREFIX_PATH=${IIT_INSTALL} cmake \
-G $CMAKE_GENERATOR \
-DCMAKE_BUILD_TYPE=${SOURCES_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=${IIT_INSTALL} \
-DICUB_MODEL_GENERATE_DH:BOOL=OFF \
-DICUB_MODEL_GENERATE_SIMMECHANICS:BOOL=ON \
-DICUB_MODELS_SOURCE_DIR=${IIT_SOURCES}/icub-models \
.. &&\
cmake --build . -- $CMAKE_EXTRA_OPTIONS &&\
find ${IIT_SOURCES}/icub-model-generator -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+ &&\
find ${IIT_INSTALL} -not -group runtimeusers -exec chgrp runtimeusers {} \; -exec chmod g+rw {} \+
# Misc setup of the image
# =======================
# Include a custom bashrc
COPY bashrc /usr/etc/skel/bashrc-dev
COPY bashrc-colors /usr/etc/skel/bashrc-colors
COPY bashrc-functions /usr/etc/skel/bashrc-functions
# Include an additional entrypoint script
COPY entrypoint.sh /usr/sbin/entrypoint_development.sh
COPY setup.sh /usr/sbin/setup_development.sh
RUN chmod 755 /usr/sbin/entrypoint_development.sh
RUN chmod 755 /usr/sbin/setup_development.sh
ENTRYPOINT ["/usr/sbin/entrypoint_development.sh"]
CMD ["bash"]