Skip to content

Commit

Permalink
Added ability to change the final Docker image for misbehaving-jmx-se…
Browse files Browse the repository at this point in the history
…rver
  • Loading branch information
carlosroman committed Dec 14, 2023
1 parent 97afdbf commit 0d94021
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.18.0</version>
<version>1.19.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
21 changes: 19 additions & 2 deletions tools/misbehaving-jmx-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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"]
ENTRYPOINT [ "/usr/bin/start.sh" ]

CMD [ "org.datadog.supervisor.App" ]
13 changes: 13 additions & 0 deletions tools/misbehaving-jmx-server/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -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 \
"$@"

0 comments on commit 0d94021

Please sign in to comment.