Commit 80a6fcff authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Update Dockerfile to run webserver with console

parent 4f6f4f91
......@@ -7,6 +7,11 @@
# Copy the Dockerfile to the empty directory: `cp dt_ctrl/Dockerfile .`
# Tar the source code with `tar czf dt_ctrl.tgz dt_ctrl`
# Create the docker file with `docker build --tag consoledemo .`
# This Dockerfile is hardcoded to run the websockets server at
# port 8000.
# Start the docker container with
# docker run -it -p 8081:80 -p 8000:8000 consoledemo
# Then visit the consoledemo from the host machine at http://localhost:8081
FROM ubuntu:16.04
RUN apt-get -y update
......@@ -18,8 +23,7 @@ RUN cd /root/libnova-libnova && libtoolize && autoreconf -i && ./configure && ma
RUN cd /root && git clone
RUN cd /root/libwebsockets && mkdir build && cd build && cmake .. && make && make install
ADD dt_ctrl.tgz /root
RUN cd /root tar xf dt_ctrl.tgz
RUN cd /root && git clone
RUN cd /root/dt_ctrl && autoconf && ./configure --with-libwebsockets=/usr/local && make
RUN cd /root/dt_ctrl && make console/console/console_httpd
......@@ -33,6 +37,45 @@ RUN cp -r /root/dt_ctrl/console/htdocs /var/www/
RUN cp -r /root/dt_ctrl/console/js /var/www/
RUN mkdir -p /var/www/htdocs/tle && touch /var/www/htdocs/tle/amateur.txt && touch /var/www/htdocs/tle/gps-ops.txt && touch /var/www/htdocs/tle/tle-new.txt
CMD screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./' && /bin/bash
RUN apt-get -y install apache2 net-tools
RUN mkdir -p /var/www/console/ && cp -r /root/dt_ctrl/console/htdocs /var/www/console && cp -r /root/dt_ctrl/console/js /var/www/console
# Configure apache to serve the console htdocs
RUN echo '\
<VirtualHost *:80>\n\
\tServerAdmin webmaster@localhost\n\
\tDocumentRoot /var/www/console/htdocs\n\
\t<Directory "/var/www/console/htdocs">\n\
\t\tOrder allow,deny\n\
\t\tAllow from all\n\
\t\tAllowOverride None\n\
\t\tAddHandler cgi-script .cgi\n\
\t\tOptions +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n\
ErrorLog ${APACHE_LOG_DIR}/error.log\n\
CustomLog ${APACHE_LOG_DIR}/access.log combined\n\
' > /etc/apache2/sites-enabled/000-default.conf
# Configure ports for the console and controller
RUN mkdir /etc/dt && echo '\
' > /etc/dt/dt_host.ini
# Patch the console software to point the websockets port
RUN sed -i -e 's/":8000"/' /var/www/console/htdocs/index.html && \
sed -i -e 's/":8000"/' /var/www/console/htdocs/mech.html
CMD screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c 'cd /root/dt_ctrl/console/console && ./' && /bin/bash -c 'service apache2 start' && bash
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment