Skip to content

Instantly share code, notes, and snippets.

@metalivedev
Last active January 2, 2016 04:39
Show Gist options
  • Save metalivedev/8251577 to your computer and use it in GitHub Desktop.
Save metalivedev/8251577 to your computer and use it in GitHub Desktop.
Containerizing RTD. Requires 1GB of RAM to compile in a VM. This version does all the apt-get's in one layer and sets up the database. You'll still need to use ./manage.py updatepassword manually -- haven't figured out how to automate that yet.
FROM ubuntu
# Add the Universe to the repo list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe' >> /etc/apt/sources.list
# You might also need redis, nginx, postgres, and celeryd to work like production RTD.
# openssh-server is optional and just makes it easier to interact with the container later.
RUN apt-get update && apt-get install -y gcc git openssh-server python-pip python-dev libxml2-dev libxslt1-dev
RUN git clone http://github.com/rtfd/readthedocs.org.git
RUN cd readthedocs.org && pip install -r pip_requirements.txt
RUN cd readthedocs.org && ./manage.py syncdb --noinput && LANG=en_US ./manage.py createsuperuser --noinput --username=root --email=root@localhost.local && ./manage.py migrate --noinput
@metalivedev
Copy link
Author

This is really early. It seems to get all the dependencies built, but it doesn't (yet):

  • run manage.py, so no admin account yet, no db's set up
  • expose any ports (needs 22 for ssh and 8000 for RTD)
  • share or mount any volumes to the host

To use, do something like this:

$ docker build -t rtdbasic .
$ docker run -i -t rtdbasic /bin/bash

That will get you a shell where you can do the manage.py things manually (for now)

@metalivedev
Copy link
Author

The admin account needs a password, but the db's are set up.
Note that createsuperuser required a locale, so I set it to en_US, though en_US is not actually installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment