From 8ee9eff0a52d01a5fcb148f9ed6ceb9be04c2b65 Mon Sep 17 00:00:00 2001 From: Grant Welch Date: Fri, 14 Jul 2017 13:59:32 -0700 Subject: [PATCH] Intro Dockerfile to ease help adoption. Users of this Dockerfile can be either contributors or administrators. For contributors, they will be able to make changes and be able to see their changes by rebuilding the image. For administrators, they will be able to quickly evaluate RTD without having to contribute a lot of time. Build: $ docker build --tag rtfd-server . Run: $ docker run -p 8000:8000 rtfd-server --- .dockerignore | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 30 ++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000000..da57daa8b9a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,84 @@ +# Git +.git +.gitignore + +# CI +.codeclimate.yml +.travis.yml + +# Docker +docker-compose.yml +.docker + +# Byte-compiled / optimized / DLL files +**/__pycache__/ +**/*.py[cod] +**/*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.cache +nosetests.xml +coverage.xml + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Virtual environment +.env/ +.venv/ +venv/ + +# PyCharm +.idea + +# Python mode for VIM +**/.ropeproject + +# Vim swap files +**/*.swp + +# Sqlite database +*.db diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..66b155bde05 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# FROM readthedocs/build:latest +FROM python:2.7.13 +# FROM python:3.6.1 + +RUN set -ex; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + elasticsearch \ + redis-server \ + ; \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /usr/src/app + +COPY requirements.txt /usr/src/app +COPY requirements /usr/src/app/requirements +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /usr/src/app/ + +RUN python manage.py migrate +RUN python manage.py createsuperuser --noinput \ + --username root \ + --email dev@localhost +RUN python manage.py collectstatic --noinput +RUN python manage.py loaddata test_data + +CMD python manage.py runserver + +EXPOSE 8000