This project provides a Dockerfile for building a self-hosted readthedocs instance.
Based on the official library/python:2.7
image from the Docker Hub and the latest
pull from github. The image currently
includes the uWSGI application server and
a sample NGiNX configuration file as an example of how one
might run a production-like setup. To drive this example a little further, we
have provided a docker-compose
configuration with some
defaults.
Using the built in Django webserver
$ docker run -d --name readthedocs \
-p 8000:8000 \
luciddg/readthedocs \
./manage.py runserver
Using the uWSGI HTTP server/router
$ docker run -d --name readthedocs \
-p 8000:8000 \
luciddg/readthedocs \
uwsgi --http :8000 --module readthedocs.wsgi --env DJANGO_SETTINGS_MODULE=readthedocs.settings.sqlite
If you choose to run it behind a fully capable webserver such as NGiNX, you
may choose to configure your container to speak the uwsgi protocol natively.
This is basically the same as above, but with the --socket
switch in place of
--http
. In this case, you will most likely link this container to an NGiNX
container, so there is no need to proxy the exposed port externally.
$ docker run -d --name readthedocs luciddg/readthedocs \
uwsgi --socket 0.0.0.0:8000 --module readthedocs.wsgi --env DJANGO_SETTINGS_MODULE=readthedocs.settings.sqlite
$ docker run -d --name nginx-proxy \
-v ${PWD}/files/nginx.conf:/etc/nginx/conf.d/default.conf:ro \
--link readthedocs:rtd \
-p 80:80 \
library/nginx
The same result may be accomplished with the provided docker-compose.yml
for
convenience. The uWSGI settings provided as command line arguments above are
provided as environment variables in our docker-compose.yml
$ docker-compose up