528c9de2736d555a396e0b1c88b0b89d2df1b9d4
[sim/o1-interface.git] / ntsimulator / deploy / manager / Dockerfile
1 FROM ubuntu:18.04
2
3 MAINTAINER alexandru.stancu@highstreet-technologies.com
4 LABEL maintainer="alexandru.stancu@highstreet-technologies.com"
5
6 #ARG BUILD_DATE
7 #LABEL build-date=$BUILD_DATE
8
9 ENV NETCONF_BASE=40000
10 ENV NTS_IP="127.0.0.1"
11 ENV SCRIPTS_DIR=/opt/dev/scripts
12 ENV DOCKER_ENGINE_VERSION="1.40"
13 ENV MODELS_IMAGE="ntsim_oran"
14
15 RUN \
16       apt-get update && apt-get install -y \
17       # general tools
18       git \
19       cmake \
20       build-essential \
21       vim \
22       supervisor \
23       # libyang
24       libpcre3-dev \
25       pkg-config \
26       # sysrepo
27       libavl-dev \
28       libev-dev \
29       libprotobuf-c-dev \
30       protobuf-c-compiler \
31       # netopeer2 \
32       libssh-dev \
33       libssl-dev \
34       # bindings
35       swig \
36       python-dev \
37       libcurl4 \
38       libcurl4-openssl-dev \
39       curl \
40       bc \
41       python-setuptools \
42       python-pip
43
44 # add netconf user
45 RUN \
46       adduser --system netconf && \
47       echo "netconf:netconf" | chpasswd
48
49 # generate ssh keys for netconf user
50 RUN \
51       mkdir -p /home/netconf/.ssh && \
52       ssh-keygen -A && \
53       ssh-keygen -t dsa -P '' -f /home/netconf/.ssh/id_dsa && \
54       cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys && \
55 #echo "Host *\n    StrictHostKeyChecking accept-new" >> /home/netconf/.ssh/config
56       echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
57       mkdir -p /root/.ssh && \
58       cat /home/netconf/.ssh/id_dsa.pub > /root/.ssh/authorized_keys
59        
60 # use /opt/dev as working directory
61 RUN mkdir /opt/dev
62 WORKDIR /opt/dev
63
64 # libcjson
65 RUN \
66           git clone https://github.com/Melacon/cJSON.git && \
67       cd cJSON && mkdir build && cd build && \
68       cmake .. -DENABLE_CJSON_UTILS=On -DENABLE_CJSON_TEST=Off -DCMAKE_INSTALL_PREFIX=/usr .. && \
69       make -j2 && \
70       make install && \
71       ldconfig
72
73 # libyang
74 RUN \
75           git clone https://github.com/Melacon/libyang.git && \
76       cd libyang && mkdir build && cd build && \
77       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
78       make -j2 && \
79       make install && \
80       ldconfig
81
82 # sysrepo
83 RUN \
84           git clone https://github.com/Melacon/sysrepo.git && \
85       sed -i 's/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    3/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    6/g' ./sysrepo/src/common/sr_mem_mgmt.h && \
86       cd sysrepo && mkdir build && cd build && \
87       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_TESTS=OFF -DREPOSITORY_LOC:PATH=/etc/sysrepo -DREQUEST_TIMEOUT=60 -DOPER_DATA_PROVIDE_TIMEOUT=60 .. && \
88       make -j2 && \
89       make install && \
90       ldconfig
91
92 # libnetconf2
93 RUN \
94           git clone https://github.com/Melacon/libnetconf2.git && \
95       cd libnetconf2 && mkdir build && cd build && \
96       cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
97       make -j2 && \
98       make install && \
99       ldconfig
100
101 # keystore
102 RUN \
103           cd /opt/dev && \
104           git clone https://github.com/Melacon/Netopeer2.git && \
105       cd /opt/dev && \
106       cd Netopeer2 && \
107       cd keystored && mkdir build && cd build && \
108       cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
109       make -j2 && \
110       make install && \
111       ldconfig
112
113 # netopeer2
114 RUN \
115       cd /opt/dev && \
116       cd Netopeer2/server && mkdir build && cd build && \
117       cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
118       make -j2 && \
119       make install && \
120       cd ../../cli && mkdir build && cd build && \
121       cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
122       make -j2 && \
123       make install
124
125 #NTSimulator Manager
126 COPY ./ntsimulator /opt/dev/ntsimulator
127 RUN \
128       cd /opt/dev && \
129       cd ntsimulator && mkdir build  && cd build && \
130       cmake .. && \
131       make -j2 && \
132       make install
133
134 COPY ntsimulator/deploy/manager/supervisord.conf.manager /etc/supervisord.conf
135           
136 ENV EDITOR vim
137 EXPOSE 830
138
139 CMD ["sh", "-c", "/usr/bin/supervisord -c /etc/supervisord.conf"]