From 97a8119efbccf9154d59da185949527ee3b5508c Mon Sep 17 00:00:00 2001 From: Oleg Lavrovsky Date: Tue, 28 Mar 2017 23:21:54 +0200 Subject: [PATCH] Docker instructions --- .dockerfile | 3 --- .gitignore | 1 + README.md | 6 +++--- docker-compose.yml | 5 +++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.dockerfile b/.dockerfile index 50c9cd9..0ae45e6 100644 --- a/.dockerfile +++ b/.dockerfile @@ -6,9 +6,6 @@ WORKDIR /usr/src/app COPY requirements.txt /usr/src/app/ RUN pip install --no-cache-dir -r requirements.txt -RUN python manage.py migrate -RUN python manage.py createsuperuser - ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 ENV LANG en_US.UTF-8 diff --git a/.gitignore b/.gitignore index d739332..950615b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.env *.pyc .sass-cache .DS_Store diff --git a/README.md b/README.md index 4540ea0..004fc7b 100644 --- a/README.md +++ b/README.md @@ -60,9 +60,9 @@ Now access the admin panel with the user account you created earlier: http://loc ## Production notes -We are using [Dokku](http://dokku.viewdocs.io/) for automated deployment. +We suggest using Docker or [Dokku](http://dokku.viewdocs.io/) for automated deployment. ``` -sudo dokku apps:create phase-alpha -sudo dokku config:set phase-alpha BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-python +docker-compose run web python manage.py migrate +docker-compose run web python manage.py createsuperuser ``` diff --git a/docker-compose.yml b/docker-compose.yml index dd65d2f..f47fe63 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,12 +10,13 @@ web: ports: - "5000:5000" environment: + - ALLOWED_HOSTS=${ALLOWED_HOSTS} + - SECRET_KEY=${SECRET_KEY} - DEBUG=${DEBUG} - DEV=${DEBUG} + - DJANGO_SETTINGS_MODULE=${DJANGO_SETTINGS_MODULE} - DATABASE_URL=postgres://postgres:@postgres:5432/postgres - ELASTICSEARCH_URL=http://elasticsearch:9200 - - SECRET_KEY=${SECRET_KEY} - - ALLOWED_HOSTS=${HOSTNAME} frontend: build: . dockerfile: .dockerfile-frontend