From bdccb2ed5f0a9621b299d432bf37df8666d88712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Trigo=20Soares?= Date: Mon, 28 Oct 2019 17:56:02 +0000 Subject: [PATCH] Dockerfile for building image in ubuntu --- .dockerignore | 9 +++++ Dockerfile | 51 +++++++++++++++++++++++++++++ config_other/httpd/000-default.conf | 22 +++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 config_other/httpd/000-default.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..42a26031 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +Dockerfile +Dockerfile.centos +LICENSE +README.md +install.sh +CONTRIBUTING.md +.git +.github +.gitignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..657959de --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM ubuntu + +ENV MYSQL_ENABLE 0 +ENV MYSQL_USER "haproxy-wi" +ENV MYSQL_PASS "haproxy-wi" +ENV MYSQL_DB "haproxywi2" +ENV MYSQL_HOST 127.0.0.1 + +ENV APACHE_RUN_DIR /var/www +ENV APACHE_LOG_DIR /var/log/apache2 +ENV APACHE_RUN_USER www-data +ENV APACHE_RUN_GROUP www-data +ENV APACHE_PID_FILE /var/run/apache2$SUFFIX/apache2.pid +ENV APACHE_LOCK_DIR /var/lock/apache2 +ENV LANG C +ENV APACHE_ULIMIT_MAX_FILES 'ulimit -n 65536' + +RUN apt-get update && \ + apt-get install net-tools lshw dos2unix apache2 gcc netcat python3.5 python3-pip g++ freetype2-demos libatlas-base-dev python-ldap libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev python3-dev libssl-dev libfreetype6-dev libpng-dev -y && \ + ln -s /usr/include/freetype2/ft2build.h /usr/include/ + +COPY . /var/www/haproxy-wi + +WORKDIR /var/www/haproxy-wi + +RUN chown -R www-data:www-data . && \ + pip3 install -r requirements.txt && \ + mkdir /var/www/haproxy-wi/keys/ && \ + mkdir -p /var/www/haproxy-wi/configs/hap_config && \ + cp /var/www/haproxy-wi/config_other/httpd/haproxy-wi.conf /etc/apache2/sites-available/ && \ + cp /var/www/haproxy-wi/config_other/httpd/000-default.conf /etc/apache2/sites-available/ && \ + ln -s /etc/apache2/mods-available/ssl.conf /etc/apache2/mods-enabled/ && \ + ln -s /etc/apache2/mods-available/ssl.load /etc/apache2/mods-enabled/ && \ + ln -s /etc/apache2/mods-available/socache_shmcb.load /etc/apache2/mods-enabled/ && \ + ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/ && \ + ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/ && \ + ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/ && \ + ln -s /var/log/apache2 /var/log/httpd + +# Build sql database +RUN set -ex; \ + if [ "$MYSQL_ENABLE" -eq 0 ]; then \ + cd /var/www/haproxy-wi/app && \ + ./create_db.py && \ + chown www-data:www-data /var/www/haproxy-wi/app/haproxy-wi.db; \ + fi + +EXPOSE 443 +VOLUME /var/www/haproxy-wi/ + +CMD /usr/sbin/apache2ctl -DFOREGROUND \ No newline at end of file diff --git a/config_other/httpd/000-default.conf b/config_other/httpd/000-default.conf new file mode 100644 index 00000000..c2da4cbd --- /dev/null +++ b/config_other/httpd/000-default.conf @@ -0,0 +1,22 @@ + + ServerName haproxy-wi + ErrorLog /var/log/httpd/haproxy-wi.error.log + CustomLog /var/log/httpd/haproxy-wi.access.log combined + TimeOut 600 + LimitRequestLine 256000 + LimitRequestFieldSize 256000 + DocumentRoot /var/www/haproxy-wi + ScriptAlias /cgi-bin/ "/var/www/haproxy-wi/app/" + + + Options +ExecCGI + AddHandler cgi-script .py + Order deny,allow + Allow from all + + + + Order Deny,Allow + Deny from all + + \ No newline at end of file