blob: 8d019140c67db04efa9f14bed9e3b81c56195be5 [file] [log] [blame]
Jakub Mand582df92021-02-01 20:48:23 +01001FROM ubuntu:18.04
2
3# Install required binaries
4RUN apt-get upgrade && apt-get update -y && apt-get install -y \
5 mongodb python3 python3-dev python3-pip \
6 pkg-config \
7 git cmake clang curl \
8 libpcre3-dev swig \
9 zlib1g-dev libgcrypt-dev libssl-dev \
10 libprotobuf-c-dev protobuf-c-compiler libavl-dev libev-dev \
11 apache2 apache2-dev
12
13RUN curl -sL https://deb.nodesource.com/setup_15.x | bash - && apt-get install -y nodejs
14
15# Install libssh from source (Version from apt is incompatible with libnetconf2)
16RUN git clone -b v0-7 http://git.libssh.org/projects/libssh.git ; cd libssh; mkdir build; cd build ;\
17 cmake ..; make; make install ; cd
18
19# Install libyang
20RUN git clone -b devel https://github.com/CESNET/libyang.git && cd libyang; \
21 mkdir build; cd build && \
22 cmake -DGEN_LANGUAGE_BINDINGS=ON -DGEN_JAVA_BINDINGS=OFF .. && make && make install && cd ../.. && ldconfig ; cd
23
24# Install libnetconf2
25RUN git clone -b devel https://github.com/CESNET/libnetconf2.git && cd libnetconf2; \
26 mkdir build; cd build && \
27 cmake -DENABLE_PYTHON=ON .. && make && make install && cd ../.. && ldconfig ; cd
28
29
30# Install sysrepo
31RUN git clone -b devel https://github.com/sysrepo/sysrepo.git ; \
32 cd sysrepo; mkdir build; cd build; \
33 cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install; \
34 cd ../.. ; \
35 ldconfig ; cd
36
37# Install netopeer
38RUN git clone -b devel https://github.com/CESNET/Netopeer2.git ;\
39 cd Netopeer2; mkdir build; cd build ;\
40 cmake .. && make && make install ; cd
41
42# Prepare GUI
43# TODO: Remove example and add app.config.json to import assets
44RUN git clone https://github.com/CESNET/liberouter-gui
45RUN cd /liberouter-gui/modules && git clone -b v2 https://github.com/CESNET/Netopeer2GUI && cd
46RUN cd /liberouter-gui && python3 bootstrap.py && \
47 pip3 install -r backend/requirements.txt && \
48 cd frontend && npm i -g npm && \
49 npm i -g @angular/cli && npm install ; cd
50
51# Build GUI
52RUN mkdir /etc/httpd ; mkdir /etc/httpd/conf.modules.d
53RUN pip3 install mod_wsgi
54RUN mod_wsgi-express module-config >/etc/httpd/conf.modules.d/00-wsgi.conf
55RUN cd /liberouter-gui/modules/Netopeer2GUI/frontend && npm i && npm run build:tools && cd
56RUN cd /liberouter-gui/frontend && npm run build && cp -R dist/* /var/www/html
57RUN cp /liberouter-gui/modules/Netopeer2GUI/docker/wsgi.py /var/www/liberouter-gui/backend/wsgi.py
58
59# Expose ports and run services
60RUN mkdir -p /data/db 2>/dev/null \
61 mongod --fork --logpath /var/log/mongod.log
62RUN sysrepod
63RUN httpd
64RUN netopeer2-server
65
66EXPOSE 80/tcp