forked from erlerobot/gym-gazebo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
436 lines (372 loc) · 14.8 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# A Dockerfile for the gym-gazebo environment
FROM ubuntu:16.04
#--------------------
# General setup
#--------------------
# Get the dependencies
RUN apt-get update \
&& apt-get install -y xorg-dev \
libgl1-mesa-dev \
xvfb \
libxinerama1 \
libxcursor1 \
unzip \
libglu1-mesa \
libav-tools \
python3 \
python3-pip \
# python3-numpy \
# python3-scipy \
# python3-pyglet \
python3-setuptools \
libpq-dev \
libjpeg-dev \
wget \
curl \
cmake \
git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/gym
#--------------------
# Install gym
#--------------------
# # Clone the official gym
# RUN git clone https://github.com/openai/gym
#
# # Install the gym's requirements
# RUN pip install -r gym/requirements.txt
#
# # Install the gym
# RUN ls -l
# RUN pip install -e gym/
# Install from pip
RUN pip3 install gym
# Checks
#RUN python --version
#RUN python -c "import gym"
# Debug
#RUN ls -l /usr/local/gym
#RUN ls -l /usr/local/gym/gym-gazebo
#RUN ls -l /usr/local/gym/gym
# #--------------------
# # Install Gazebo
# #--------------------
RUN sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable xenial main" > /etc/apt/sources.list.d/gazebo-stable.list'
RUN wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add -
RUN apt-get update
RUN apt-get install gazebo8 -y
# RUN apt-get install -y libglib2.0-dev libgts-dev libgts-dev
RUN apt-get install -y libgazebo8-dev
# setup environment
EXPOSE 11345
#--------------------
# Install ROS
#--------------------
# RUN apt-get install -y locales-all
# # setup environment
# RUN locale-gen en_US.UTF-8
# ENV LANG en_US.UTF-8
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
# setup keys
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
# setup sources.list
RUN echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list
# RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
#
# # install ros packages
ENV ROS_DISTRO kinetic
RUN apt-get install cmake gcc g++
# # Install from repositories (for Python 2.7)
#----------------------------
# install bootstrap tools
# RUN apt-get update && apt-get install --no-install-recommends -y \
# python-rosdep \
# python-rosinstall \
# python-vcstools \
# && rm -rf /var/lib/apt/lists/*
# RUN apt-get update && apt-get install -y \
# ros-kinetic-ros-base && rm -rf /var/lib/apt/lists/*
#
# RUN apt-get install ros-kinetic-*
# # Install additional dependencies
# RUN apt-get install -y ros-kinetic-cv-bridge
# RUN apt-get install -y ros-kinetic-robot-state-publisher ros-kinetic-control-msgs
# Install from sources
#----------------------------
# RUN apt-get install python3-rosdep python3-rosinstall-generator python3-wstool \
# python3-rosinstall build-essential
# or alternatively,
RUN apt-get update && apt-get install libboost-all-dev -y
RUN pip3 install --upgrade pip
RUN pip3 install -U rosdep rosinstall_generator wstool rosinstall
RUN pip3 install rospkg catkin_pkg empy
# bootstrap rosdep
RUN rosdep init \
&& rosdep update
RUN mkdir ~/ros_catkin_ws
# Create package set
RUN cd ~/ros_catkin_ws && rosinstall_generator ros_comm --rosdistro kinetic \
--deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
# Fetch packages
RUN cd ~/ros_catkin_ws && wstool init -j1 src kinetic-ros_comm-wet.rosinstall
# # Solve dependencies
# RUN cd ~/ros_catkin_ws && rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
# Create symbolic link for the compilation
RUN cd /usr/bin && ln -sf python3 python
# Install console_bridge from packages
RUN apt-get install libconsole-bridge-dev -y
# # Compile/install console_bridge as a library
# RUN git clone git://github.com/ros/console_bridge.git
# RUN cd console_bridge && cmake . && make
# RUN cd console_bridge && make install
RUN apt-get install -y libtinyxml-dev liblz4-dev libbz2-dev liburdfdom-dev libpoco-dev \
libtinyxml2-dev
# # Compile the basic ROS packages, optimize docker production
# RUN cd ~/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated -DPYTHON_VERSION=3.5 --install -DCMAKE_BUILD_TYPE=Release
# Add a few packages and dependencies by hand
# RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/console_bridge
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-controls/control_toolbox
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-controls/realtime_tools
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/actionlib
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/pluginlib
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/class_loader
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/urdf
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-simulation/gazebo_ros_pkgs
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/common_msgs
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-controls/control_msgs
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/vmayoral/dynamic_reconfigure
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/geometry
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/erlerobot/orocos_kinematics_dynamics
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/angles
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/geometry2
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/rosconsole_bridge
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/nodelet_core
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/bond_core
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-perception/image_common
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-perception/vision_opencv
# #--------------------
# # Follow up with the ROS intallation, splited in this funny way to optimize docker's performance
# #--------------------
RUN apt-get install -y libeigen3-dev python3-sip python3-sip-dev libyaml-cpp-dev \
libboost-python-dev unzip
# this installs an old version, not valid: libopencv-dev
# # Ignore some repositories due to some issues with libboost_python3
# # https://github.com/ros/ros-overlay/issues/93
# RUN touch /root/ros_catkin_ws/src/image_common/camera_calibration_parsers/CATKIN_IGNORE
# RUN touch /root/ros_catkin_ws/src/image_common/camera_info_manager/CATKIN_IGNORE
RUN cd /usr/lib/x86_64-linux-gnu/ && ln -s libboost_python-py35.so libboost_python3.so
# #--------------------
# # Install OpenCV
# #--------------------
# # From sources
# RUN git clone https://github.com/opencv/opencv
# RUN cd opencv && mkdir build && cd build && cmake .. && make
# RUN cd opencv/build && make install
# Compile OpenCV from sources
WORKDIR /root
RUN wget https://github.com/opencv/opencv/archive/3.2.0.zip
RUN ls /root
RUN unzip 3.2.0.zip
RUN mv opencv-3.2.0 OpenCV
RUN cd OpenCV && mkdir build && cd build && cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..
RUN cd OpenCV/build && make -j4
RUN cd OpenCV/build && make install
RUN cd OpenCV/build && ldconfig
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros/diagnostics
RUN cd ~/ros_catkin_ws/src && git clone https://github.com/ros-controls/ros_control
# Compile the again the workspace
RUN cd ~/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated -DPYTHON_VERSION=3.5 \
--install -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=OFF
# Debug
# RUN ls -l /opt/ros
# upgrade pip
#RUN apt-get install python3-pyqt4
# #--------------------
# # Install ROS 2
# #--------------------
# Inspired on https://github.com/osrf/docker_images/blob/master/ros2/source/source/Dockerfile
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list'
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN pip3 install configparser
# RUN apt-get install python-pkg-resources
# install packages
RUN apt-get update && apt-get install -q -y \
# bash-completion \
# build-essential \
clang-format \
# # cmake \
# cppcheck \
# git \
libasio-dev \
# libeigen3-dev \
# libopencv-dev \
# libpoco-dev \
libpocofoundation9v5 \
libpocofoundation9v5-dbg \
libssl-dev \
# libtinyxml-dev \
# libtinyxml2-dev \
openssl \
# pydocstyle \
# pyflakes \
# python-empy \
python3-coverage \
python3-dev \
python3-empy \
python3-mock \
python3-nose \
python3-pep8 \
python3-pip \
python3-setuptools \
python3-vcstool \
python3-yaml \
uncrustify \
wget \
&& rm -rf /var/lib/apt/lists/*
# install python packages
RUN pip3 install -U \
argcomplete \
flake8 \
flake8-import-order
# clone source
ENV ROS2_WS /root/ros2_ws
RUN mkdir -p $ROS2_WS/src
WORKDIR $ROS2_WS
RUN wget https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos \
&& vcs import src < ros2.repos
RUN pip3 install pyparsing pytest
# build source
WORKDIR $ROS2_WS
RUN src/ament/ament_tools/scripts/ament.py \
build \
--build-tests \
--cmake-args -DSECURITY=OFF -- \
--isolated \
--parallel \
--symlink-install
WORKDIR /root
#--------------------
# Install Sophus
#--------------------
# RUN git clone https://github.com/stonier/sophus -b indigo && \
# cd sophus && mkdir build && cd build && cmake .. && make
# RUN ls -l
# RUN cd sophus/build && make install
# RUN echo "## Sophus installed ##\n"
# # FROM pip
# RUN pip3 install opencv-python
#RUN cd /usr/local/gym
# More dependencies
RUN pip3 install h5py
RUN apt-get update && apt-get install -y bash-completion \
python3-defusedxml python3-skimage
#--------------------
# Install baselines
#--------------------
RUN pip3 install baselines
RUN pip3 install netifaces
#--------------------
# Install individual environments
#--------------------
WORKDIR /root
# Turtlebot
RUN cd ros_catkin_ws/src && git clone https://github.com/turtlebot/turtlebot
RUN cd ros_catkin_ws/src && git clone https://github.com/turtlebot/turtlebot_create
RUN cd ros_catkin_ws/src && git clone https://github.com/turtlebot/turtlebot_simulator
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-drivers/joystick_drivers.git
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/kobuki
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/kobuki_core
# RUN cd ros_catkin_ws/src && git clone https://github.com/erlerobot/kobuki_desktop
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/kobuki_msgs
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-planning/navigation
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-perception/perception_pcl.git
RUN cd ros_catkin_ws/src && git clone https://github.com/ros/xacro
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/yocs_msgs
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/yujin_ocs
RUN cd ros_catkin_ws/src && git clone https://github.com/stonier/ecl_core
RUN cd ros_catkin_ws/src && git clone https://github.com/stonier/ecl_lite
RUN cd ros_catkin_ws/src && git clone https://github.com/stonier/ecl_navigation
RUN cd ros_catkin_ws/src && git clone https://github.com/stonier/ecl_tools
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-drivers/driver_common.git
RUN apt-get install -y libftdi-dev
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-visualization/rqt_robot_dashboard
RUN apt-get install -y libsdl-dev libsdl-image1.2-dev libspnav-dev
# installing pcl-dev causes some conflicts
RUN apt-get install -y libpcl-dev; exit 0
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-perception/pcl_msgs
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-perception/pcl_conversions
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-gbp/bfl-release -b release/kinetic/bfl
# # CATKIN_IGNORE kobuki_gazebo_plugins
# RUN cd ros_catkin_ws/src/kobuki_desktop/kobuki_gazebo_plugins && touch CATKIN_IGNORE
RUN cd ros_catkin_ws/src && git clone https://github.com/yujinrobot/kobuki_desktop -b devel
# Fix obtained from https://aur.archlinux.org/packages/ros-indigo-kobuki-gazebo-plugins/
# checkout version 0.5.1, which compiles
RUN cd ros_catkin_ws/src/kobuki_desktop && git checkout 3d837662928748cf1e229d2e0b0d98f1031ed4a4
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-perception/laser_geometry
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-planning/navigation_msgs
RUN cd ros_catkin_ws/src && git clone https://github.com/ros/roslint
# CATKIN_IGNORE wiimote
RUN cd ros_catkin_ws/src/joystick_drivers/wiimote && touch CATKIN_IGNORE
# # CATKIN_IGNORE yocs_ar_marker_tracking
# RUN cd ros_catkin_ws/src/yujin_ocs/yocs_ar_marker_tracking && touch CATKIN_IGNORE
RUN cd ros_catkin_ws/src && git clone https://github.com/ros-perception/ar_track_alvar
RUN cd ros_catkin_ws/src && git clone https://github.com/ros/resource_retriever
# CATKIN_IGNORE kobuki test suites
RUN cd ros_catkin_ws/src/kobuki/kobuki_testsuite && touch CATKIN_IGNORE
RUN cd ros_catkin_ws/src/kobuki_desktop/kobuki_qtestsuite && touch CATKIN_IGNORE
RUN cd ros_catkin_ws/src && git clone https://github.com/ros/robot_state_publisher
RUN cd ros_catkin_ws/src && git clone https://github.com/ros/kdl_parser
# Compile the again the workspace
RUN cd ~/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated -DPYTHON_VERSION=3.5 \
--install -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=OFF
#--------------------
# Copy the code
#--------------------
# this invalidates the cache
RUN mkdir gym-gazebo
# COPY . /usr/local/gym/gym-gazebo
COPY . /root/gym-gazebo
# # #--------------------
# # # Install deep learning toolkits
# # #--------------------
# # # install dependencies
# # RUN pip install h5py
# # RUN apt-get install gfortran -y
# #
# # # install sript specific dependencies (temporal)
# # RUN apt-get install python-skimage -y
# #
# # # install Theano
# # #RUN git clone git://github.com/Theano/Theano.git
# # #RUN cd Theano/ && python setup.py develop
# # RUN pip install Theano
# #
# # # install Keras
# # RUN pip install keras
#
#--------------------
# Install gym-gazebo
#--------------------
RUN cd gym-gazebo && pip3 install -e .
# # old method
# # install dependencies
# RUN cd /usr/local/gym/gym-gazebo/gym_gazebo/envs/installation && bash setup.bash
#WORKDIR /root
#ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
# setup entrypoint
#RUN ls /usr/local/gym/gym-gazebo/
#RUN ls ./gym-gazebo
#COPY /usr/local/gym/gym-gazebo/entrypoint.sh /
#
#--------------------
# Entry point
#--------------------
COPY entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]