From 0d94021cb3819da72563cfe0481ccdb2495efb26 Mon Sep 17 00:00:00 2001 From: Carlos Roman Date: Thu, 14 Dec 2023 10:31:52 +0000 Subject: [PATCH] Added ability to change the final Docker image for misbehaving-jmx-server --- pom.xml | 2 +- tools/misbehaving-jmx-server/Dockerfile | 21 +++++++++++++++++-- tools/misbehaving-jmx-server/scripts/start.sh | 13 ++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100755 tools/misbehaving-jmx-server/scripts/start.sh diff --git a/pom.xml b/pom.xml index 18cd989b3..15b614823 100644 --- a/pom.xml +++ b/pom.xml @@ -200,7 +200,7 @@ org.testcontainers testcontainers - 1.18.0 + 1.19.3 test diff --git a/tools/misbehaving-jmx-server/Dockerfile b/tools/misbehaving-jmx-server/Dockerfile index 938e8c112..3b322530c 100644 --- a/tools/misbehaving-jmx-server/Dockerfile +++ b/tools/misbehaving-jmx-server/Dockerfile @@ -1,3 +1,6 @@ +# syntax=docker/dockerfile:1 +# Use by default the JDK image used to build the jar +ARG FINAL_JRE_IMAGE=base # Use the official JDK image as the base image FROM eclipse-temurin:17 AS base @@ -18,13 +21,27 @@ RUN set -eu && \ ./mvnw clean package assembly:single; # Use the base image as the the final image -FROM base AS final +FROM ${FINAL_JRE_IMAGE} AS final +#FROM eclipse-temurin:${JDK_VERSION} AS final # Set the working directory to /app WORKDIR /app +COPY scripts/start.sh /usr/bin/ + # Copy the JAR file from the Maven image to the final image COPY --from=build /app/target/misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar . +# RMI Port +EXPOSE 9090 + +# Control Port +EXPOSE 9091 + +# Supervisor Port +EXPOSE 9092 + # Run the supervisor class from the jar -CMD ["java", "-cp", "misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar", "org.datadog.supervisor.App"] \ No newline at end of file +ENTRYPOINT [ "/usr/bin/start.sh" ] + +CMD [ "org.datadog.supervisor.App" ] diff --git a/tools/misbehaving-jmx-server/scripts/start.sh b/tools/misbehaving-jmx-server/scripts/start.sh new file mode 100755 index 000000000..9ed57c8d0 --- /dev/null +++ b/tools/misbehaving-jmx-server/scripts/start.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +set -f + +echo "Running $@" + +[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms256M" + +# shellcheck disable=SC2086 +java \ + ${JAVA_OPTS} \ + -cp misbehavingjmxserver-1.0-SNAPSHOT-jar-with-dependencies.jar \ + "$@"