Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame^] | 1 | FROM ubuntu:18.04
|
| 2 |
|
| 3 | # Install required binaries
|
| 4 | RUN 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 |
|
| 13 | RUN 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)
|
| 16 | RUN 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
|
| 20 | RUN 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
|
| 25 | RUN 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
|
| 31 | RUN 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
|
| 38 | RUN 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
|
| 44 | RUN git clone https://github.com/CESNET/liberouter-gui
|
| 45 | RUN cd /liberouter-gui/modules && git clone -b v2 https://github.com/CESNET/Netopeer2GUI && cd
|
| 46 | RUN 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
|
| 52 | RUN mkdir /etc/httpd ; mkdir /etc/httpd/conf.modules.d
|
| 53 | RUN pip3 install mod_wsgi
|
| 54 | RUN mod_wsgi-express module-config >/etc/httpd/conf.modules.d/00-wsgi.conf
|
| 55 | RUN cd /liberouter-gui/modules/Netopeer2GUI/frontend && npm i && npm run build:tools && cd
|
| 56 | RUN cd /liberouter-gui/frontend && npm run build && cp -R dist/* /var/www/html
|
| 57 | RUN cp /liberouter-gui/modules/Netopeer2GUI/docker/wsgi.py /var/www/liberouter-gui/backend/wsgi.py
|
| 58 |
|
| 59 | # Expose ports and run services
|
| 60 | RUN mkdir -p /data/db 2>/dev/null \
|
| 61 | mongod --fork --logpath /var/log/mongod.log
|
| 62 | RUN sysrepod
|
| 63 | RUN httpd
|
| 64 | RUN netopeer2-server
|
| 65 |
|
| 66 | EXPOSE 80/tcp |