Tweak Docker config files and add documentation.

This commit is contained in:
Christopher Charbonneau Wells 2017-11-24 14:39:20 -05:00
parent 12254b0861
commit 823b2e764b
3 changed files with 36 additions and 1 deletions

View File

@ -14,6 +14,7 @@ RUN gulp build
FROM python:3 as app FROM python:3 as app
ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pipenv gunicorn RUN pip install --upgrade pipenv gunicorn
WORKDIR /app WORKDIR /app
COPY Pipfile /app/ COPY Pipfile /app/

View File

@ -18,6 +18,7 @@ work.
- [Demo](#demo) - [Demo](#demo)
- [Deployment](#deployment) - [Deployment](#deployment)
- [AWS Elastic Beanstalk](#aws-elastic-beanstalk) - [AWS Elastic Beanstalk](#aws-elastic-beanstalk)
- [Docker](#docker)
- [Nanobox](#nanobox) - [Nanobox](#nanobox)
- [Heroku](#heroku) - [Heroku](#heroku)
- [Manual](#manual) - [Manual](#manual)
@ -72,6 +73,39 @@ for detailed information.
The create command will also do an initial deployment. Run `eb deploy` to The create command will also do an initial deployment. Run `eb deploy` to
redeploy the app (e.g. if there are errors or settings are changed). redeploy the app (e.g. if there are errors or settings are changed).
### Docker
A Docker deploy requires [Docker](http://docker.com/) and
[Docker Compose](https://docs.docker.com/compose/overview/) to create two
containers - one for the database and one for the application.
1. Copy the `docker.env.example` to `docker.env` and set the `ALLOWED_HOSTS` and
`SECRET_KEY` variables within
cp docker.env.example docker.env
editor docker.env
1. Build the web container
docker-compose build
1. Initialize the database (this will also build the db container)
docker-compose run --rm web python manage.py migrate
1. Initialize static assets
docker-compose run --rm web python manage.py collectstatic
1. Launch! :rocket:
docker-composer up
The app should now be locally available at
[http://127.0.0.1:8000](http://127.0.0.1:8000). See
[Get Started, Part 6: Deploy your app](https://docs.docker.com/get-started/part6/)
for detailed information about how to deployment methods with Docker.
### Nanobox ### Nanobox
An example [Nanobox](https://nanobox.io/) configuration, `boxfile.yml`, is An example [Nanobox](https://nanobox.io/) configuration, `boxfile.yml`, is

View File

@ -1,4 +1,4 @@
ALLOWED_HOSTS= ALLOWED_HOSTS=
DEBUG=False
DJANGO_SETTINGS_MODULE=babybuddy.settings.docker DJANGO_SETTINGS_MODULE=babybuddy.settings.docker
PYTHONUNBUFFERED=1
SECRET_KEY= SECRET_KEY=