diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 7ff90fc7c3..67a500a07a 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -87,6 +87,11 @@ DEBUG = _is_true(get_setting( CONFIG.get('debug', True) )) +DOCKER = _is_true(get_setting( + 'INVENTREE_DOCKER', + False +)) + # Configure logging settings log_level = get_setting( 'INVENTREE_LOG_LEVEL', diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index e8743028a0..734b365447 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -81,6 +81,13 @@ def inventree_in_debug_mode(*args, **kwargs): return djangosettings.DEBUG +@register.simple_tag() +def inventree_docker_mode(*args, **kwargs): + """ Return True if the server is running as a Docker image """ + + return djangosettings.DOCKER + + @register.simple_tag() def inventree_db_engine(*args, **kwargs): """ Return the InvenTree database backend e.g. 'postgresql' """ diff --git a/docker/Dockerfile b/docker/Dockerfile index 3e0a7e1230..ea70d9f994 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,7 @@ ENV INVENTREE_REPO="${repository}" ENV INVENTREE_BRANCH="${branch}" ENV INVENTREE_LOG_LEVEL="INFO" +ENV INVENTREE_DOCKER="true" # InvenTree paths ENV INVENTREE_SRC_DIR="${INVENTREE_HOME}/src"