forked from gaoxiang12/slambook2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·183 lines (166 loc) · 4.23 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
ARG UBUNTU_VERSION=18.04
# https://hub.docker.com/r/nvidia/cudagl
ARG ARCH=gl
ARG CUDA=10.2
FROM nvidia/cuda${ARCH}:${CUDA}-base-ubuntu${UBUNTU_VERSION} as base
LABEL maintainer="Emiliano Borghi"
ARG uid
ENV USER slam
# Setup environment
RUN apt-get update && apt-get install -y locales
RUN locale-gen en_US.UTF-8
ENV \
LANG=en_US.UTF-8 \
DEBIAN_FRONTEND=noninteractive \
TERM=xterm
# Dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
apt-transport-https \
apt-utils \
bash-completion \
build-essential \
ca-certificates \
cmake \
eog \
gdb \
git \
gnupg2 \
libxt-dev \
mesa-utils \
nano \
software-properties-common \
sudo \
tmux \
unzip \
wget
# Create a user with passwordless sudo
USER root
RUN adduser --gecos "Development User" --disabled-password -u ${uid} $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Install third part libraries
# OpenCV 3
RUN apt-get update \
&& apt-get install -y \
libopencv-dev \
python3-matplotlib \
python3-opencv \
python-pip \
python3-pip \
python3-scipy \
python-tk \
&& ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
RUN pip2 install \
matplotlib \
opencv-contrib-python \
scikit-build
COPY 3rdparty /3rdparty
# Ceres solver
RUN mkdir -p /3rdparty/ceres-solver/build
WORKDIR /3rdparty/ceres-solver/build
RUN apt-get update && \
apt-get install -y \
cmake \
libatlas-base-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
libsuitesparse-dev
RUN cmake ..
RUN make -j3
RUN make install
RUN ldconfig
# DBoW3
RUN mkdir -p /3rdparty/DBoW3/build
WORKDIR /3rdparty/DBoW3/build
RUN cmake ..
RUN make -j3
RUN make install
RUN ldconfig
# Pangolin
RUN apt-get update && \
apt-get install -y \
cmake \
libglew-dev \
libpython2.7-dev
RUN pip3 install \
numpy \
pyopengl \
Pillow \
pybind11
RUN mkdir -p /3rdparty/Pangolin/build
WORKDIR /3rdparty/Pangolin/build
RUN cmake ..
RUN make -j3
RUN make install
RUN ldconfig
# Sophus
RUN mkdir -p /3rdparty/Sophus/build
WORKDIR /3rdparty/Sophus/build
RUN cmake ..
RUN make -j3
RUN make install
RUN ldconfig
# g2o
RUN apt-get update && \
apt-get install -y \
libqglviewer-dev-qt5 \
libsuitesparse-dev \
qt5-qmake \
qtdeclarative5-dev
RUN mkdir -p /3rdparty/g2o/build
WORKDIR /3rdparty/g2o/build
RUN cmake ..
RUN make -j3
RUN make install
RUN ldconfig
# GTest
RUN apt-get update && \
apt-get install -y \
libgtest-dev
RUN mkdir -p /usr/src/googletest/googletest/build
WORKDIR /usr/src/googletest/googletest/build
RUN cmake ..
RUN make
RUN cp libgtest* /usr/lib/
RUN mkdir /usr/local/lib/googletest
RUN ln -s /usr/lib/libgtest.a /usr/local/lib/googletest/libgtest.a
RUN ln -s /usr/lib/libgtest_main.a /usr/local/lib/googletest/libgtest_main.a
# Install ROS Melodic
# Setup sources.list for ROS
RUN echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list
# Setup keys for ROS
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# Install bootstrap tools
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
python-rosdep \
python-rosinstall
# Install ROS packages
RUN apt-get update \
&& apt-get install -y \
ros-melodic-octomap-ros \
ros-melodic-ros-base
# Initialize rosdep
RUN rosdep init
USER $USER
RUN rosdep update
# Automatically source ROS workspace
RUN echo ". /opt/ros/melodic/setup.bash" >> /home/${USER}/.bashrc
ENV WS_DIR "/catkin_ws"
ENV CATKIN_SETUP_BASH "${WS_DIR}/devel/setup.bash"
RUN echo "[[ -f ${CATKIN_SETUP_BASH} ]] && . ${CATKIN_SETUP_BASH}" >> /home/${USER}/.bashrc
# Compile exercises
USER root
RUN apt-get update && \
apt-get install -y \
freeglut3-dev \
libpcl-dev \
octomap-tools
USER ${USER}
WORKDIR /exercises
COPY entrypoint.sh /entrypoint.sh
CMD [ "/entrypoint.sh" ]