From 8b06c2c6e9b599ce887f8e26f451878511ba3557 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Feb 2024 17:18:29 +0900 Subject: [PATCH] docker: add entrypoint and add support for dynamic config --- Dockerfile | 3 +++ dynamicweb/settings/base.py | 6 ++++++ entrypoint.sh | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 395ebcc9..4c1a9a66 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,3 +27,6 @@ COPY requirements.txt ./ RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install --no-cache-dir -r requirements.txt" COPY ./ . +COPY entrypoint.sh / + +ENTRYPOINT ["/entrypoint.sh" ] diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index f03042dc..b7705e17 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -777,3 +777,9 @@ if DEBUG: from .local import * # flake8: noqa else: from .prod import * # flake8: noqa + +# Try to load dynamic configuration, if it exists +try: + from .dynamic import * # flake8: noqa +except ImportError: + pass diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..e207a457 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -uex + +cd /usr/src/app/ +cat > dynamicweb/settings/dynamic.py <