Skip to content

Commit

Permalink
added Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jpylephilalegal committed Oct 7, 2015
1 parent 48f05ca commit 987bbf0
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*~
*.pyc
en
*/auto
foobar.pickle
*/build
*.egg-info
*/dist
make_session_store.py
da.wsgi
oauth.wsgi
trash
site
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
17 changes: 17 additions & 0 deletions docassemble_webapp/apache.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<VirtualHost *:80>
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
<Directory /var/lib/docassemble/webapp>
WSGIProcessGroup docassemble.webserver
WSGIApplicationGroup %{GLOBAL}
AllowOverride none
Require all granted
</Directory>
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
</VirtualHost>

0 comments on commit 987bbf0

Please sign in to comment.