Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

DO NOT MERGE: refresh Dockerfile a little #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM python:3.6
FROM uisautomation/django:2.0-py3.6
RUN apk add --no-cache bash

WORKDIR /usr/src/app

Expand All @@ -8,4 +9,4 @@ RUN pip install -r ./requirements_docker.txt
ADD ./ /usr/src/app/

ENV DJANGO_SETTINGS_MODULE=lookupproxy.settings.docker
ENTRYPOINT ["scripts/docker-entrypoint.sh"]
ENTRYPOINT ["./scripts/docker-entrypoint.sh"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@ This application ships with a basic packaging using Docker. It makes use of
container is configured to use lookupproxy.settings.docker by default as the
Django settings. In use you probably want to override this with a settings
module which includes at least the OAuth2 configuration and SECRET_KEY setting.

The following environment variables are mapped to the corresponding Django
settings:

* ``OAUTH2_TOKEN_URL``
* ``OAUTH2_INTROSPECT_URL``
* ``OAUTH2_CLIENT_ID``
* ``OAUTH2_CLIENT_SECRET``
* ``OAUTH2_INTROSPECT_SCOPES`` (scopes should be separated by spaces)
37 changes: 37 additions & 0 deletions lookupproxy/settings/docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .base import * # noqa: F403
import os

DEBUG = False
ALLOWED_HOSTS = ['*']
Expand All @@ -11,3 +12,39 @@

# In production, use the production lookup
LOOKUP_API_ENDPOINT_HOST = 'www.lookup.cam.ac.uk'

# Load OAuth2 settings from environment if present
OAUTH2_TOKEN_URL = os.environ.get('OAUTH2_TOKEN_URL', None)
OAUTH2_INTROSPECT_URL = os.environ.get('OAUTH2_INTROSPECT_URL', None)
OAUTH2_CLIENT_ID = os.environ.get('OAUTH2_CLIENT_ID', None)
OAUTH2_CLIENT_SECRET = os.environ.get('OAUTH2_CLIENT_SECRET', None)
OAUTH2_INTROSPECT_SCOPES = os.environ.get('OAUTH2_INTROSPECT_SCOPES', '').split(' ')

# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(levelname)s %(asctime)s %(pathname)s:%(lineno)d '
'%(funcName)s "%(message)s"')
},
'simple': {
'format': '%(levelname)s "%(message)s"'
},
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'propagate': True,
'level': 'INFO'
},
}
}