From 4b26486e6daaa4aa69bdc4a9aef21677d3cec63f Mon Sep 17 00:00:00 2001 From: Jinoy Parekh Date: Mon, 7 Dec 2020 20:43:34 -0600 Subject: [PATCH 1/3] Updated Dfile and reorg config/app.yml --- Dockerfile | 6 ++---- {scripts => config}/application.yml | 0 2 files changed, 2 insertions(+), 4 deletions(-) rename {scripts => config}/application.yml (100%) diff --git a/Dockerfile b/Dockerfile index 66df061..194b8c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,15 +22,13 @@ WORKDIR /app COPY --from=base /app /app -COPY scripts/application.yml /app/application.yml +COPY config/application.yml /app/application.yml COPY scripts/entrypoint.sh /app/entrypoint.sh ENV MICRONAUT_CONFIG_FILES=/app/application.yml -RUN useradd -u 1001 akhq - -RUN chown -R akhq /app +RUN chown -R 1001 /app RUN dnf upgrade -y && \ dnf clean all && \ diff --git a/scripts/application.yml b/config/application.yml similarity index 100% rename from scripts/application.yml rename to config/application.yml -- GitLab From 1420e26ef740254262b96a8649b50ba292f53300 Mon Sep 17 00:00:00 2001 From: Jinoy Parekh Date: Mon, 7 Dec 2020 21:50:09 -0600 Subject: [PATCH 2/3] Update Dfile --- Dockerfile | 9 +++++++-- scripts/akhq | 11 +++++++++++ scripts/entrypoint.sh | 9 --------- scripts/jvm.options | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 11 deletions(-) create mode 100644 scripts/akhq delete mode 100644 scripts/entrypoint.sh create mode 100644 scripts/jvm.options diff --git a/Dockerfile b/Dockerfile index 194b8c0..684ba36 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,10 +20,14 @@ USER 0 WORKDIR /app -COPY --from=base /app /app +COPY --from=base /app/akhq.jar /app/akhq.jar COPY config/application.yml /app/application.yml +COPY scripts/akhq /app/akhq + +COPY scripts/jvm.options /app/jvm.options + COPY scripts/entrypoint.sh /app/entrypoint.sh ENV MICRONAUT_CONFIG_FILES=/app/application.yml @@ -32,7 +36,8 @@ RUN chown -R 1001 /app RUN dnf upgrade -y && \ dnf clean all && \ - rm -rf /var/cache/dnf + rm -rf /var/cache/dnf && \ + chmod +x /app/akhq ENTRYPOINT ["entrypoint.sh"] diff --git a/scripts/akhq b/scripts/akhq new file mode 100644 index 0000000..1ec024e --- /dev/null +++ b/scripts/akhq @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +# Read user-defined JVM options from jvm.options file +JVM_HOME="/usr/lib/jvm/java-11-openjdk-11.0.9.11-2.el8_3.x86_64/bin/java" +JVM_OPTS_FILE=${JVM_OPTS_FILE:-/app/jvm.options} +for JVM_OPT in `grep "^-" ${JVM_OPTS_FILE}` +do + JAVA_OPTS="${JAVA_OPTS} ${JVM_OPT}" +done + +${JVM_HOME} ${JAVA_OPTS} -jar /app/akhq.jar diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh deleted file mode 100644 index 52228a6..0000000 --- a/scripts/entrypoint.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh - -set -e - -if [ "${AKHQ_CONFIGURATION}" ]; then - echo "${AKHQ_CONFIGURATION}" > /app/application.yml -fi - -exec "$@" diff --git a/scripts/jvm.options b/scripts/jvm.options new file mode 100644 index 0000000..c046099 --- /dev/null +++ b/scripts/jvm.options @@ -0,0 +1,34 @@ +########################################################################### +# jvm.options # +# # +# - all flags defined here will be used to startup the JVM # +# - one flag should be specified per line # +# - lines that do not start with '-' will be ignored # +# - only static flags are accepted (no variables or parameters) # +# - dynamic flags will be appended to these on cassandra-env # +########################################################################### + +# Server Hotspot JVM +-server + +# ensure UTF-8 encoding by default (e.g. filenames) +-Dfile.encoding=UTF-8 + +# set to headless, just in case +-Djava.awt.headless=true + +# generate a heap dump when an allocation from the Java heap fails +# heap dumps are created in the working directory of the JVM +-XX:+HeapDumpOnOutOfMemoryError +-XX:HeapDumpPath=/tmp/heapdump.log + +# Do not rely on the system configuration +-Dfile.encoding=UTF-8 +-Duser.timezone=UTC + +# Jmx Remote +-Dcom.sun.management.jmxremote +-Dcom.sun.management.jmxremote.port=8686 +-Dcom.sun.management.jmxremote.local.only=false +-Dcom.sun.management.jmxremote.authenticate=false +-Dcom.sun.management.jmxremote.ssl=false -- GitLab From 0e922a06c157be0a3b3d6159907c69a6e96fe1f0 Mon Sep 17 00:00:00 2001 From: Jinoy Parekh Date: Mon, 7 Dec 2020 22:00:18 -0600 Subject: [PATCH 3/3] Updated scripts/** --- scripts/entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 scripts/entrypoint.sh diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh new file mode 100644 index 0000000..52228a6 --- /dev/null +++ b/scripts/entrypoint.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +set -e + +if [ "${AKHQ_CONFIGURATION}" ]; then + echo "${AKHQ_CONFIGURATION}" > /app/application.yml +fi + +exec "$@" -- GitLab