From 0ab3c2c0d3f9f551334fc0390d0da4fd60c36fab Mon Sep 17 00:00:00 2001 From: "Code Hugger (Matthew Jones)" Date: Thu, 8 Jul 2021 13:39:17 -0400 Subject: [PATCH] Fixes #1269 - Moving collectstatic out of Dockerfile (#1285) --- dashboard/settings.py | 3 ++- dockerfiles/Dockerfile | 3 +-- dockerfiles/Dockerfile.openshift | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dashboard/settings.py b/dashboard/settings.py index 8561da682..5a59549f5 100644 --- a/dashboard/settings.py +++ b/dashboard/settings.py @@ -13,6 +13,7 @@ import json, os from typing import Tuple, Union +from django.core.management.utils import get_random_secret_key from django.utils.module_loading import import_string # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -70,7 +71,7 @@ # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = ENV.get('DJANGO_SECRET_KEY') +SECRET_KEY = ENV.get('DJANGO_SECRET_KEY', get_random_secret_key()) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = ENV.get('DJANGO_DEBUG', True) diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 1267d4099..52c1d4860 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -55,8 +55,7 @@ COPY --from=node-prod-deps /usr/src/app/node_modules node_modules # NOTE: project files likely to change between dev builds COPY . . -# This DJANGO_SECRET_KEY is set here just so collectstatic runs with an empty key. It can be set to anything -RUN echo yes | DJANGO_SECRET_KEY="collectstatic" python manage.py collectstatic --verbosity 0 +RUN python manage.py collectstatic --verbosity 0 --noinput # Sets the local timezone of the docker image ARG TZ diff --git a/dockerfiles/Dockerfile.openshift b/dockerfiles/Dockerfile.openshift index 82bb72e90..e8a58bcc2 100644 --- a/dockerfiles/Dockerfile.openshift +++ b/dockerfiles/Dockerfile.openshift @@ -54,8 +54,7 @@ COPY --from=node-prod-deps /usr/src/app/node_modules node_modules # NOTE: project files likely to change between dev builds COPY . . -# This DJANGO_SECRET_KEY is set here just so collectstatic runs with an empty key. It can be set to anything -RUN echo yes | DJANGO_SECRET_KEY="collectstatic" python manage.py collectstatic --verbosity 0 +RUN python manage.py collectstatic --verbosity 0 --noinput # Sets the local timezone of the docker image ARG TZ