diff --git a/Dockerfile b/Dockerfile index 66df0615173e35ae9a179d0519d8c1338699f9f5..684ba3647efc285b1184dd7cff7a880112e8eb50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,21 +20,24 @@ USER 0 WORKDIR /app -COPY --from=base /app /app +COPY --from=base /app/akhq.jar /app/akhq.jar -COPY scripts/application.yml /app/application.yml +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 -RUN useradd -u 1001 akhq - -RUN chown -R akhq /app +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/application.yml b/config/application.yml similarity index 100% rename from scripts/application.yml rename to config/application.yml diff --git a/scripts/akhq b/scripts/akhq new file mode 100644 index 0000000000000000000000000000000000000000..1ec024e461db209898ba794be73c99a33f4e9726 --- /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/jvm.options b/scripts/jvm.options new file mode 100644 index 0000000000000000000000000000000000000000..c0460993d5fbaa9aede3954cfda20952a66b9336 --- /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