diff --git a/Dockerfile b/Dockerfile index 1799be58..8a0b7c3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,9 +27,8 @@ 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/ -EXPOSE 8000 -ENTRYPOINT gunicorn -c /app/gunicorn.py babybuddy.wsgi diff --git a/babybuddy/settings/docker.py b/babybuddy/settings/docker.py new file mode 100644 index 00000000..7e98ccc8 --- /dev/null +++ b/babybuddy/settings/docker.py @@ -0,0 +1,25 @@ +import os + +from .base import * # noqa: F401,F403 + + +DEBUG = os.environ.get('DEBUG', False) + + +# SECURITY WARNING: keep the secret key used in production secret! + +SECRET_KEY = os.environ.get('SECRET_KEY') + + +# Database +# https://docs.djangoproject.com/en/1.11/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'postgres', + 'USER': 'postgres', + 'HOST': 'db', + 'PORT': 5432, + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..07bf8171 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: "2" + +services: + db: + image: postgres + web: + build: . + command: gunicorn -c /app/gunicorn.py babybuddy.wsgi + ports: + - "8000:8000" + depends_on: + - db