Merged in DCD-1086-jvm-fallback-fonts (pull request #69)

DCD-1086: Add Google Noto fonts and install as JVM fallback for server-side rendering of non-Latin languages.

Approved-by: Adam Brokes
Approved-by: Dave Chevell
This commit is contained in:
Steve Smith 2020-08-25 03:04:29 +00:00
commit 01d3f5c3b9
3 changed files with 21 additions and 5 deletions

View File

@ -20,7 +20,7 @@ CMD ["/entrypoint.py"]
ENTRYPOINT ["/sbin/tini", "--"]
RUN apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends fontconfig python3 python3-jinja2 \
&& apt-get install -y --no-install-recommends fontconfig fonts-noto python3 python3-jinja2 \
&& apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
ARG TINI_VERSION=v0.18.0
@ -45,7 +45,10 @@ RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \
\
&& 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
&& 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 \
\
&& mkdir -p /opt/java/openjdk/lib/fonts/fallback/ \
&& ln -sf /usr/share/fonts/truetype/noto/* /opt/java/openjdk/lib/fonts/fallback/
VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms

View File

@ -19,7 +19,9 @@ EXPOSE 8091
CMD ["/entrypoint.py"]
ENTRYPOINT ["/sbin/tini", "--"]
RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl ttf-dejavu tini python3 py3-jinja2
RUN apk update \
&& apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl tini python3 py3-jinja2 ttf-dejavu `apk search -qe 'font-noto*'` \
&& rm -f /var/cache/apk/APKINDEX*
# Workaround for AdoptOpenJDK Alpine fontconfig bug
RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so \
@ -44,7 +46,10 @@ RUN addgroup -g ${RUN_GID} ${RUN_GROUP} \
\
&& 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
&& 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 \
\
&& mkdir -p /opt/java/openjdk/lib/fonts/fallback/ \
&& ln -sf /usr/share/fonts/noto/* /opt/java/openjdk/lib/fonts/fallback/
VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms

View File

@ -40,7 +40,7 @@ def test_first_run_state(docker_cli, image, run_user):
container = run_image(docker_cli, image, user=run_user, ports={PORT: PORT})
wait_for_http_response(URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN'))
wait_for_http_response(URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN'), max_wait=120)
def test_server_xml_defaults(docker_cli, image):
@ -331,3 +331,11 @@ def test_jvm_support_recommended_args_order(docker_cli, image):
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)
def test_jvm_fallback_fonts(docker_cli, image):
container = run_image(docker_cli, image)
_jvm = wait_for_proc(container, get_bootstrap_proc(container))
font = container.file("/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf")
assert font.exists
assert font.is_symlink