-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
164 lines (149 loc) · 6.27 KB
/
Copy pathDockerfile
File metadata and controls
164 lines (149 loc) · 6.27 KB
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
#############################################
# Fetch base docker image
#############################################
FROM ubuntu:18.04
SHELL ["/bin/bash", "-c"]
#############################################
# Install essential packages
#############################################
RUN apt update && apt upgrade -y
RUN apt install -y ca-certificates
RUN echo $'deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse\n\
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse\n\
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse\n\
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse\n' \
| tee -a /etc/apt/sources.list
RUN apt update && apt upgrade -y
RUN apt install -y apt-utils gcc g++ openssh-server cmake build-essential gdb gdbserver rsync vim git
#############################################
# Configure sshd
#############################################
RUN mkdir /var/run/sshd
RUN echo 'root:root' | chpasswd
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN echo "StrictHostKeyChecking accept-new" >> /etc/ssh/ssh_config
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
RUN echo "export VISIBLE=now" >> /etc/profile
#############################################
# Open ports for SSH, debugger, and RTP
#############################################
EXPOSE 22 7777 8000 3307
#############################################
# Add debugger user for Clion Remote Dev
#############################################
RUN useradd -ms /bin/bash debugger
RUN echo 'debugger:pwd' | chpasswd
#############################################
# Setup SSH Keys to access Github Private Repo
#############################################
RUN mkdir -p /root/.ssh
ADD ./id_rsa /root/.ssh/id_rsa
#############################################
# Build and install coding library
#############################################
#WORKDIR /bats-code-library-workdir
#RUN git clone git@github.com:batsiot/bats-code-library-2016
#RUN cd bats-code-library-2016 && mkdir build && cd build && cmake .. && make && make install
#############################################
# Build and install OpenCV
#############################################
WORKDIR /opencv-build-workdir
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libavformat-dev \
libpq-dev \
libgtk2.0-dev \
pkg-config
RUN apt install -y python3
RUN apt install -y python3-pip
RUN pip3 install numpy
WORKDIR /
ENV OPENCV_VERSION="4.1.0"
RUN wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& rm ${OPENCV_VERSION}.zip
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip \
&& unzip ${OPENCV_VERSION}.zip \
&& mkdir /opencv-${OPENCV_VERSION}/cmake_binary \
&& cd /opencv-${OPENCV_VERSION}/cmake_binary \
&& cmake -DBUILD_TIFF=ON \
-DBUILD_opencv_java=OFF \
-DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib-${OPENCV_VERSION}/modules \
-DWITH_CUDA=OFF \
-DWITH_OPENGL=ON \
-DWITH_OPENCL=ON \
-DWITH_IPP=ON \
-DWITH_TBB=ON \
-DWITH_EIGEN=ON \
-DWITH_V4L=ON \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DCMAKE_BUILD_TYPE=RELEASE \
.. \
&& make -j4 && make install \
&& rm /${OPENCV_VERSION}.zip \
&& rm -r /opencv-${OPENCV_VERSION}
ADD 3rdparty/aruco /aruco
WORKDIR /aruco
RUN mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/ && make -j4 && make install
RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/aruco.conf && ldconfig
WORKDIR /
ADD 3rdparty/marker_mapper /marker_mapper
WORKDIR /marker_mapper
RUN mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && make -j4 && make install
RUN ldconfig
WORKDIR /
#############################################
# Build and install batspro2
#############################################
WORKDIR /bats-protocol-workdir
RUN apt install -y libboost-all-dev
RUN apt install -y iproute2
RUN apt install -y htop net-tools iputils-ping vlc
RUN DEBIAN_FRONTEND="noninteractive" apt install -y expect iperf3
RUN git clone git@github.com:batsiot/batspro2
RUN cd batspro2 && dpkg -i libbats-0.1.3-Linux-amd64.deb
RUN cd batspro2 && echo $'install (TARGETS btp ipc DESTINATION lib)\n\
install (FILES include/BCMPPacket.h \
include/BPPacket.h \
include/BTPPacket.h \
include/INIReader.h \
include/Queue.h \
include/Thread.h \
include/ThreadPool.h \
include/bats-protocol.h \
Socket/include/BATSSocket.h \
Socket/include/BPSocket.h \
Socket/include/IPC_UDS.h \
DESTINATION include)' | tee -a /bats-protocol-workdir/batspro2/BTP/CMakeLists.txt
RUN sed -i 's/LOG_MSQ_MAX_MSGS\s16/LOG_MSQ_MAX_MSGS 10/g' batspro2/Utilities/BATSLogger/include/BATSLogger.h
RUN cd batspro2 && mkdir build && cd build && cmake .. && make -j4 && make install
#############################################
# Enable SSH
#############################################
CMD ["/usr/sbin/sshd", "-D"]
#############################################
# Setup MySQL Server
#############################################
RUN apt install -y libmysqlcppconn-dev
ADD ./.display /.display
RUN cat /.display >> /etc/environment
#############################################
# Enable BATS network simulation
#############################################
# CMD ["/bats-protocol-workdir/batspro2/Utilities/simulation/bmsim_ipv4.sh", "start", "4"]
# A virtual BATS network is established at the start of the docker container
# Node 0: 0.0.1.0 <-> Node 1: 0.0.1.1 <-> Node 2: 0.0.1.2 <-> Node 3: 0.0.1.3