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 # database
*.sqlite3 *.sqlite3
# docker
docker.env
# npm folder # npm folder
/node_modules /node_modules

View File

@ -5,16 +5,15 @@ ADD package-lock.json /build/
RUN npm install RUN npm install
RUN npm install -g gulp-cli RUN npm install -g gulp-cli
ADD gulpfile.js /build/gulpfile.js ADD gulpfile.js /build/gulpfile.js
ADD api /app/api ADD api /build/api
ADD babybuddy /app/babybuddy ADD babybuddy /build/babybuddy
ADD core /app/core ADD core /build/core
ADD dashboard /app/dashboard ADD dashboard /build/dashboard
ADD reports /app/reports ADD reports /build/reports
RUN gulp build 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/
@ -26,9 +25,5 @@ ADD babybuddy /app/babybuddy
ADD core /app/core ADD core /app/core
ADD dashboard /app/dashboard ADD dashboard /app/dashboard
ADD reports /app/reports ADD reports /app/reports
ENV DJANGO_SETTINGS_MODULE babybuddy.settings.development
ENV SECRET_KEY TODOCHANGEME
COPY --from=build /build/babybuddy/static /app/babybuddy/static 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/ ADD etc/gunicorn.py /app/

View File

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

View File

@ -4,6 +4,7 @@ services:
db: db:
image: postgres image: postgres
web: web:
env_file: docker.env
build: . build: .
command: gunicorn -c /app/gunicorn.py babybuddy.wsgi command: gunicorn -c /app/gunicorn.py babybuddy.wsgi
ports: ports:

4
docker.env.example Normal file
View File

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