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 \
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 11 | apache2 apache2-dev libapache2-mod-wsgi-py3
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 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 ;\
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 17 | cmake ..; make; make install ; cd /
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 18 |
|
| 19 | # Install libyang
|
| 20 | RUN git clone -b devel https://github.com/CESNET/libyang.git && cd libyang; \
|
| 21 | mkdir build; cd build && \
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 22 | cmake -DGEN_LANGUAGE_BINDINGS=ON -DGEN_JAVA_BINDINGS=OFF .. && make && make install && cd ../.. && ldconfig ; cd /
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 23 |
|
| 24 | # Install libnetconf2
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 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 && \
|
| 28 | python3 /libnetconf2/build/python/setup.py install && cd /
|
| 29 | # Manually running setup.py is a temporary workaround because of a bug in libnetconf2
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 30 |
|
| 31 | # Install sysrepo
|
| 32 | RUN git clone -b devel https://github.com/sysrepo/sysrepo.git ; \
|
| 33 | cd sysrepo; mkdir build; cd build; \
|
| 34 | cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install; \
|
| 35 | cd ../.. ; \
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 36 | ldconfig ; cd /
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 37 |
|
| 38 | # Install netopeer
|
| 39 | RUN git clone -b devel https://github.com/CESNET/Netopeer2.git ;\
|
| 40 | cd Netopeer2; mkdir build; cd build ;\
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 41 | cmake .. && make && make install ; cd /
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 42 |
|
| 43 | # Prepare GUI
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 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
|
| 46 | # && rm -rf /liberouter-gui/modules/example
|
| 47 | RUN cp /liberouter-gui/modules/netopeer2gui/app.config.json /liberouter-gui/modules/app.config.json && rm /liberouter-gui/modules/netopeer2gui/app.config.json
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 48 | RUN cd /liberouter-gui && python3 bootstrap.py && \
|
| 49 | pip3 install -r backend/requirements.txt && \
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 50 | cd frontend && npm install -g npm@7.5.2 && \
|
| 51 | npm i -g @angular/cli && npm install --legacy-peer-deps
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 52 |
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 53 | # Temporary workaround until import is fixed for tools
|
| 54 | RUN rm /liberouter-gui/modules/netopeer2gui/frontend/projects/shared-styles/_colors.scss && \
|
| 55 | cp /liberouter-gui/frontend/src/styles/_colors.scss /liberouter-gui/modules/netopeer2gui/frontend/projects/shared-styles/_colors.scss
|
| 56 | RUN echo "\$colorSuccess: #44bd32;" >> /liberouter-gui/modules/netopeer2gui/frontend/projects/shared-styles/_colors.scss && \
|
| 57 | echo "\$colorError: #ee1d23;" >> /liberouter-gui/modules/netopeer2gui/frontend/projects/shared-styles/_colors.scss
|
| 58 |
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 59 | # Build GUI
|
| 60 | RUN mkdir /etc/httpd ; mkdir /etc/httpd/conf.modules.d
|
| 61 | RUN pip3 install mod_wsgi
|
| 62 | RUN mod_wsgi-express module-config >/etc/httpd/conf.modules.d/00-wsgi.conf
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 63 | RUN pip3 uninstall mod_wsgi -y
|
| 64 | RUN cd /liberouter-gui/modules/netopeer2gui/frontend && npm i && npm run build:tools && cd
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 65 | RUN cd /liberouter-gui/frontend && npm run build && cp -R dist/* /var/www/html
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 66 |
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 67 | # Setup apache server
|
| 68 | RUN mkdir -p /var/www/liberouter-gui && cp -r /liberouter-gui/backend /var/www/liberouter-gui
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 69 | RUN rm /var/www/liberouter-gui/backend/liberouterapi/modules/netconf && cp -r /liberouter-gui/modules/netopeer2gui/backend/. /var/www/liberouter-gui/backend/liberouterapi/modules/netopeer2gui
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 70 | RUN cp /liberouter-gui/modules/netopeer2gui/docker/wsgi.py /var/www/liberouter-gui/backend/wsgi.py
|
| 71 | COPY liberouter.conf /etc/apache2/sites-available
|
| 72 | RUN a2ensite liberouter && a2dissite 000-default
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 73 | RUN a2enmod rewrite
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 74 | COPY config.ini /var/www/liberouter-gui/backend/config.ini
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 75 | COPY .htaccess /var/www/html/.htaccess
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 76 | RUN chown -R www-data:www-data /var/www/liberouter-gui
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 77 | RUN chown -R www-data:www-data /liberouter-gui/modules/netopeer2gui/backend
|
| 78 | # App needs to write configuration files
|
| 79 | RUN chmod -R +w /var/www/liberouter-gui
|
| 80 |
|
| 81 | # Change root password for netconf connection
|
| 82 | # DO NOT USE IN PRODUCTION ENVIRONMENT!
|
| 83 | RUN echo 'root:docker' | chpasswd
|
Jakub Man | d582df9 | 2021-02-01 20:48:23 +0100 | [diff] [blame] | 84 |
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 85 | # Expose HTTP
|
| 86 | EXPOSE 80/tcp
|
Jakub Man | 12e5fc8 | 2021-02-04 15:57:36 +0100 | [diff] [blame^] | 87 | EXPOSE 830
|
Jakub Man | 67527f8 | 2021-02-04 12:36:25 +0100 | [diff] [blame] | 88 |
|
| 89 |
|
| 90 | COPY services.sh /root
|
| 91 | CMD ["/bin/bash", "/root/services.sh"]
|