-
Notifications
You must be signed in to change notification settings - Fork 91
Added Dockerfile #326
Added Dockerfile #326
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Base image | ||
FROM ubuntu | ||
|
||
# Update the sources list | ||
RUN apt-get update | ||
|
||
# Install packages | ||
RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential python python-dev python-distribute python-pip zlib1g-dev python-virtualenv apache2 libapache2-mod-wsgi | ||
|
||
# Enable wsgi module | ||
RUN a2enmod wsgi | ||
|
||
# Create cache directories | ||
RUN mkdir /var/cache/apache2/python-egg-cache && \ | ||
chown www-data:www-data /var/cache/apache2/python-egg-cache/ | ||
|
||
# Set up GA4GH server | ||
RUN mkdir /srv/ga4gh | ||
WORKDIR /srv/ga4gh | ||
RUN virtualenv ga4gh-server-env | ||
RUN /bin/bash -c "source ga4gh-server-env/bin/activate" | ||
RUN pip install git+https://github.com/ga4gh/server | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we install from git or from PyPI for the default Docker install? I would say PyPI probably. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current version PyPI server has a wormtable dependency that won't On Thu, Apr 2, 2015 at 1:02 AM Jerome Kelleher notifications@github.com
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah OK. This will be fixed today, when we tag and upload 0.1.0a3. |
||
|
||
# Install relevant sample data | ||
RUN wget http://www.well.ox.ac.uk/~jk/ga4gh-example-data.tar.gz && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're using an uncompressed tarball now - you can remove the .gzs and the wormtable deletes. |
||
tar -zxf ga4gh-example-data.tar.gz && rm -r ga4gh-example-data/variants/*.wt | ||
|
||
# Write application.wsgi | ||
RUN echo "from ga4gh.frontend import app as application\nimport ga4gh.frontend as frontend\nfrontend.configure(\"/srv/ga4gh/config.py\")" > application.wsgi | ||
|
||
# Write config.py | ||
RUN echo "DATA_SOURCE = \"/srv/ga4gh/ga4gh-example-data\"" > config.py | ||
|
||
# Write new apache config | ||
WORKDIR /etc/apache2/sites-available | ||
RUN echo "<VirtualHost *:80>\n ServerAdmin webmaster@localhost\n DocumentRoot /var/www/html\n ErrorLog ${APACHE_LOG_DIR}/error.log\n CustomLog ${APACHE_LOG_DIR}/access.log combined\n WSGIDaemonProcess ga4gh python-path=/srv/ga4gh/ga4gh-server-env/lib/python2.7/site-packages python-eggs=/var/cache/apache2/python-egg-cache\n WSGIScriptAlias /ga4gh /srv/ga4gh/application.wsgi\n <Directory /srv/ga4gh>\n WSGIProcessGroup ga4gh\n WSGIApplicationGroup %{GLOBAL}\n Require all granted\n </Directory>\n</VirtualHost>" > 001-ga4gh.conf | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to split these long lines? It's a bit hard to read what's going on here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is just running bash commands, perhaps a here document? http://tldp.org/LDP/abs/html/here-docs.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's been a lot of discussion of heredocs for Dockerfiles -- cf moby/moby#1799 -- but they are still not supported as far as I can tell. It seems like the consensus is to use the ADD command to copy an external file into the image. That has the advantage of readability, but it loses the simplicity of having everything in the one file. It would also be possible to make the Dockerfile more readable by writing lines one at a time, but at the expense of generating an intermediate docker image for every single line added. That adds quite a lot of overhead in building the image. |
||
|
||
# Configure apache to serve GA4GH site | ||
WORKDIR /etc/apache2/sites-enabled | ||
RUN rm -f 000-default.conf && ln -s /etc/apache2/sites-available/001-ga4gh.conf 001-ga4gh.conf | ||
|
||
# Open port 80 | ||
EXPOSE 80 | ||
|
||
# Start server when container starts | ||
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, is there any point in using a virtualenv inside a Docker image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This blog post has a pretty good discussion about that issue. They seem undecided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting... I guess we should play with both options and see what works better for us.