From 450cd06bfb2cc4187b274243f2044f738811f378 Mon Sep 17 00:00:00 2001 From: Dave Chevell Date: Fri, 29 May 2020 16:46:57 +1000 Subject: [PATCH] Move JVM_SUPPORT_RECOMMENDED_ARGS to the end --- Dockerfile | 5 +++-- Dockerfile-alpine | 5 +++-- tests/test_image.py | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a07542..de0ad57 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,8 +43,9 @@ RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \ && chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_INSTALL_DIR}/work \ && chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_HOME} \ \ - && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} \${JVM_SUPPORT_RECOMMENDED_ARGS} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ - && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh + && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms diff --git a/Dockerfile-alpine b/Dockerfile-alpine index d4fc7f1..176b935 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -42,8 +42,9 @@ RUN addgroup -g ${RUN_GID} ${RUN_GROUP} \ && chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_INSTALL_DIR}/work \ && chown -R ${RUN_USER}:${RUN_GROUP} ${CONFLUENCE_HOME} \ \ - && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} \${JVM_SUPPORT_RECOMMENDED_ARGS} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ - && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh + && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms diff --git a/tests/test_image.py b/tests/test_image.py index 4f76c18..1d65ec1 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -308,3 +308,17 @@ def test_non_root_user(docker_cli, image): RUN_GID = 2002 container = run_image(docker_cli, image, user=f'{RUN_UID}:{RUN_GID}') _jvm = wait_for_proc(container, get_bootstrap_proc(container)) + + +def test_jvm_support_recommended_args_order(docker_cli, image): + ENABLE_PRINTGCDETAILS = '-XX:+PrintGCDetails' + DISABLE_PRINTGCDETAILS = '-XX:-PrintGCDetails' + environment = { + 'JVM_SUPPORT_RECOMMENDED_ARGS': ENABLE_PRINTGCDETAILS, + } + container = run_image(docker_cli, image, environment=environment) + _jvm = wait_for_proc(container, get_bootstrap_proc(container)) + + procs_list = get_procs(container) + jvm = [proc for proc in procs_list if get_bootstrap_proc(container) in proc][0] + assert jvm.index(ENABLE_PRINTGCDETAILS) > jvm.index(DISABLE_PRINTGCDETAILS)