From 987bbf05d42709ef21decb3114bd3a80c231d469 Mon Sep 17 00:00:00 2001 From: Jonathan Pyle Date: Tue, 6 Oct 2015 20:59:32 -0400 Subject: [PATCH] added Dockerfile --- .dockerignore | 13 ++++++++++++ Dockerfile | 39 ++++++++++++++++++++++++++++++++++ docassemble_webapp/apache.conf | 17 +++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docassemble_webapp/apache.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..36d6473cb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +*~ +*.pyc +en +*/auto +foobar.pickle +*/build +*.egg-info +*/dist +make_session_store.py +da.wsgi +oauth.wsgi +trash +site diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..21c458e22 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM debian:latest + +RUN apt-get update && apt-get install -y python-html2text python-markdown python-yaml python-mako python-dateutil python-setuptools python-httplib2 python-dev python-imaging python-pip wget unzip git locales pandoc texlive texlive-latex-extra apache2 postgresql python-psycopg2 libapache2-mod-wsgi python-bcrypt python-speaklater poppler-utils python-pil libffi-dev libffi6 libjs-jquery + +RUN pip install -y us 3to2 guess-language-spirit +RUN pip install -y mdx_smartypants titlecase +RUN pip install -y cffi wtforms werkzeug rauth simplekv Flask-KVSession flask-user pypdf flask flask-login flask-sqlalchemy Flask-WTF babel blinker sqlalchemy +RUN ./compile.sh + +RUN mkdir -p /var/www/.local +RUN chown www-data.www-data /var/www/.local +RUN mkdir -p /var/lib/docassemble/webapp +COPY docassemble_webapp/flask.wsgi /var/lib/docassemble/webapp/ +RUN chown www-data.www-data /var/lib/docassemble/webapp/flask.wsgi +RUN mkdir -p /usr/share/docassemble/files +RUN chown www-data.www-data /usr/share/docassemble/files +RUN mkdir -p /etc/docassemble +COPY docassemble_base/config.yml /etc/docassemble/ +COPY docassemble_webapp/apache.conf /etc/apache2/sites-available/000-default.conf + +USER postgres +RUN echo 'create role "www-data" login; create database docassemble;' | psql +RUN python docassemble_webapp/docassemble/webapp/create_tables.py +RUN echo 'grant all on all tables in schema public to "www-data"; grant all on all sequences in schema public to "www-data";' | psql docassemble + +USER root +WORKDIR /tmp +RUN git clone https://github.com/nekstrom/pyrtf-ng && cd pyrtf-ng && python setup.py install +WORKDIR /tmp +RUN wget https://www.nodebox.net/code/data/media/linguistics.zip && unzip linguistics.zip -d /usr/local/lib/python2.7/dist-packages && rm linguistics.zip + +RUN a2enmod wsgi +ENV APACHE_RUN_USER www-data +ENV APACHE_RUN_GROUP www-data +ENV APACHE_LOG_DIR /var/log/apache2 + +EXPOSE 80 + +CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] diff --git a/docassemble_webapp/apache.conf b/docassemble_webapp/apache.conf new file mode 100644 index 000000000..84b8863c3 --- /dev/null +++ b/docassemble_webapp/apache.conf @@ -0,0 +1,17 @@ + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + WSGIDaemonProcess docassemble.webserver user=www-data group=www-data threads=5 + WSGIScriptAlias / /var/lib/docassemble/webapp/flask.wsgi + + WSGIProcessGroup docassemble.webserver + WSGIApplicationGroup %{GLOBAL} + AllowOverride none + Require all granted + + Alias /robots.txt /var/www/html/robots.txt + Alias /favicon.ico /var/www/html/favicon.ico + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined +