From 059f21ae43d19aca0fd834f21ce4469501834ea4 Mon Sep 17 00:00:00 2001 From: nscuro Date: Fri, 4 Aug 2023 14:53:22 +0200 Subject: [PATCH] Allow for custom logging configuration Signed-off-by: nscuro --- .dockerignore | 1 + src/main/docker/Dockerfile | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 73cd897d7e..71b752ec6f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ docs/ scripts/ src/ +!src/main/docker/logback*.xml target/ !target/*.jar /*.md \ No newline at end of file diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 6efbb9d8ca..db9d862260 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -32,7 +32,8 @@ ENV TZ=Etc/UTC \ HOME=${DATA_DIR} \ # Default notification publisher templates override environment variables DEFAULT_TEMPLATES_OVERRIDE_ENABLED=false \ - DEFAULT_TEMPLATES_OVERRIDE_BASE_DIRECTORY=${DATA_DIR} + DEFAULT_TEMPLATES_OVERRIDE_BASE_DIRECTORY=${DATA_DIR} \ + LOGGING_CONFIG_PATH="logback.xml" # Create the directories where the WAR will be deployed to (${APP_DIR}) and Dependency-Track will store its data (${DATA_DIR}) # Create a user and assign home directory to a ${DATA_DIR} @@ -61,7 +62,12 @@ USER ${UID} WORKDIR ${APP_DIR} # Launch Dependency-Track -CMD exec java ${JAVA_OPTIONS} ${EXTRA_JAVA_OPTIONS} --add-opens java.base/java.util.concurrent=ALL-UNNAMED -DdependencyTrack.logging.level=${LOGGING_LEVEL} -jar ${WAR_FILENAME} -context ${CONTEXT} +CMD exec java ${JAVA_OPTIONS} ${EXTRA_JAVA_OPTIONS} \ + --add-opens java.base/java.util.concurrent=ALL-UNNAMED \ + -Dlogback.configurationFile=${LOGGING_CONFIG_PATH} \ + -DdependencyTrack.logging.level=${LOGGING_LEVEL} \ + -jar ${WAR_FILENAME} \ + -context ${CONTEXT} # Specify which port Dependency-Track listens on EXPOSE 8080