-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
189 lines (166 loc) · 5.22 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
FROM ubuntu:14.04
RUN \
apt-get update && apt-get install -y \
git \
curl \
wget \
libssl-dev \
libtool \
build-essential \
autoconf \
automake \
pkg-config \
libgtk-3-dev \
make \
vim \
valgrind \
doxygen \
libev-dev \
libavl-dev \
libpcre3-dev \
unzip \
sudo \
python-setuptools \
python-dev \
build-essential \
bison \
flex
# pyang
RUN easy_install pip
RUN pip install --upgrade pyang
# Adding netconf user
RUN adduser --system netconf
RUN mkdir -p /home/netconf/.ssh
RUN echo "netconf:netconf" | chpasswd && adduser netconf sudo
# Clearing and setting authorized ssh keys
RUN echo '' > /home/netconf/.ssh/authorized_keys
RUN ssh-keygen -A
RUN ssh-keygen -t dsa -P '' -f /home/netconf/.ssh/id_dsa
RUN cat /home/netconf/.ssh/id_dsa.pub >> /home/netconf/.ssh/authorized_keys
# Updating shell to bash
RUN sed -i s#/home/netconf:/bin/false#/home/netconf:/bin/bash# /etc/passwd
RUN mkdir /opt/dev && sudo chown -R netconf /opt/dev
# set root password to root
RUN echo "root:root" | chpasswd
# upgrade cmake to 3.5
RUN \
cd /opt/dev && \
wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz && \
tar -xvf cmake-3.5.2.tar.gz && rm cmake-3.5.2.tar.gz && cd cmake-3.5.2 && \
./bootstrap && \
make -j2 && \
make install
# swig
RUN \
cd /opt/dev && \
wget http://downloads.sourceforge.net/swig/swig-3.0.8.tar.gz && \
tar -xvf swig-3.0.8.tar.gz && rm swig-3.0.8.tar.gz && cd swig-3.0.8 && \
./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings && \
make && \
make install && \
install -v -m755 -d /usr/share/doc/swig-3.0.8 && \
cp -v -R Doc/* /usr/share/doc/swig-3.0.8
#cmocka
RUN \
cd /opt/dev && \
git clone git://git.cryptomilk.org/projects/cmocka.git && cd cmocka && \
git checkout tags/cmocka-1.0.1 && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && \
make -j2 && \
make install
# libssh
RUN \
cd /opt/dev && \
git clone http://git.libssh.org/projects/libssh.git && cd libssh && \
mkdir build && cd build && \
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && \
make -j2 && \
make install
# protobuf
RUN \
cd /opt/dev && \
git clone https://github.com/google/protobuf.git && cd protobuf && \
./autogen.sh && \
./configure --prefix=/usr && \
make -j2 && \
make install
# protobuf-c
RUN \
cd /opt/dev && \
git clone https://github.com/protobuf-c/protobuf-c.git && cd protobuf-c && \
./autogen.sh && \
./configure --prefix=/usr && \
make -j2 && \
make install
# install lua
RUN \
apt-get update && apt-get install -y \
luajit \
luarocks
# install node v4.x
RUN \
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash - && \
sudo apt-get install -y nodejs && \
npm install -g node-gyp
# fix nodejs name problem in ubunt
RUN sudo ln -sf /usr/bin/nodejs /usr/bin/node
# libredblack
RUN \
cd /opt/dev && \
git clone https://github.com/sysrepo/libredblack.git && cd libredblack && \
./configure && \
make -j2 && \
make install
# libyang
RUN \
cd /opt/dev && \
git clone https://github.com/CESNET/libyang.git && cd libyang && \
git checkout master && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE:String="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_BUILD_TESTS=OFF .. && \
make -j2 && \
make install
# libnetconf2
RUN \
cd /opt/dev && \
git clone https://github.com/CESNET/libnetconf2.git && cd libnetconf2 && \
git checkout master && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE:String="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_BUILD_TESTS=OFF .. && \
make -j2 && \
make install
# sysrepo
RUN \
cd /opt/dev && \
git clone https://github.com/sysrepo/sysrepo.git && cd sysrepo && \
mkdir build && cd build && \
cmake -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DREPOSITORY_LOC:PATH=/etc/sysrepo .. && \
make -j2 && \
make install
# netopeer 2
RUN \
cd /opt/dev && git clone https://github.com/CESNET/Netopeer2.git && cd Netopeer2 && \
git checkout master && \
cd /opt/dev/Netopeer2/server && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE:String="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && \
make -j2 && \
make install && \
cd /opt/dev/Netopeer2/cli && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE:String="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr .. && \
make -j2 && \
make install
# install libyang javascript bindings
RUN \
cd /opt/dev/libyang && \
mkdir build_javascript_bindings && cd build_javascript_bindings && \
cmake -DCMAKE_BUILD_TYPE:String="Release" -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_BUILD_TESTS=OFF -DJAVASCRIPT_BINDING=ON .. && \
make -j2 && \
cd javascript && \
node-gyp configure && \
node-gyp build
EXPOSE 6001
CMD ["/usr/bin/sysrepod"]
CMD ["/usr/bin/netopeer2-server", "-d"]