Update docker-compose config using an environment file.

This commit is contained in:
Christopher Charbonneau Wells 2017-11-24 11:36:02 -05:00
parent c4527cbced
commit 12254b0861
5 changed files with 20 additions and 15 deletions

3
.gitignore vendored
View File

@ -5,6 +5,9 @@
# database
*.sqlite3
# docker
docker.env
# npm folder
/node_modules

View File

@ -5,16 +5,15 @@ ADD package-lock.json /build/
RUN npm install
RUN npm install -g gulp-cli
ADD gulpfile.js /build/gulpfile.js
ADD api /app/api
ADD babybuddy /app/babybuddy
ADD core /app/core
ADD dashboard /app/dashboard
ADD reports /app/reports
ADD api /build/api
ADD babybuddy /build/babybuddy
ADD core /build/core
ADD dashboard /build/dashboard
ADD reports /build/reports
RUN gulp build
FROM python:3 as app
ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pipenv gunicorn
WORKDIR /app
COPY Pipfile /app/
@ -26,9 +25,5 @@ ADD babybuddy /app/babybuddy
ADD core /app/core
ADD dashboard /app/dashboard
ADD reports /app/reports
ENV DJANGO_SETTINGS_MODULE babybuddy.settings.development
ENV SECRET_KEY TODOCHANGEME
COPY --from=build /build/babybuddy/static /app/babybuddy/static
RUN python manage.py collectstatic --no-input
RUN python manage.py migrate
ADD etc/gunicorn.py /app/

View File

@ -3,13 +3,15 @@ import os
from .base import * # noqa: F401,F403
DEBUG = os.environ.get('DEBUG', False)
# SECURITY WARNING: keep the secret key used in production secret!
# Production settings
# See babybuddy.settings.base for additional settings information.
SECRET_KEY = os.environ.get('SECRET_KEY')
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '').split(',')
DEBUG = os.environ.get('DEBUG', False)
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases

View File

@ -4,9 +4,10 @@ services:
db:
image: postgres
web:
env_file: docker.env
build: .
command: gunicorn -c /app/gunicorn.py babybuddy.wsgi
ports:
- "8000:8000"
depends_on:
- db
- db

4
docker.env.example Normal file
View File

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