From eaba02d7bddc880b3d4e0811fddda57e8ec8fca3 Mon Sep 17 00:00:00 2001 From: skynetcap <100323448+skynetcap@users.noreply.github.com> Date: Wed, 27 Dec 2023 09:44:55 -0800 Subject: [PATCH] Add Dockerfile for application build and package This commit introduces a Dockerfile that defines two stages: a build stage and a package stage. It uses Maven for building the application and GraalVM for running it. The build artifacts are copied from the build stage to the package stage. The Dockerfile also includes commented out code for future use such as Yourkit profiler and Remote Debugging setup. --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a38be91 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +FROM maven:3.8.6-eclipse-temurin-17 AS build + +# Tray Icon +# apt-get install libxrender1:i386 libxtst6:i386 libxi6:i386 + +# Yourkit +#RUN apt-get update \ +# && apt-get install unzip -y \ +# && apt-get install wget -y +# +#RUN wget https://www.yourkit.com/download/docker/YourKit-JavaProfiler-2022.3-docker.zip -P /home/ && \ +# unzip /home/YourKit-JavaProfiler-2022.3-docker.zip -d /usr/local && \ +# rm /home/YourKit-JavaProfiler-2022.3-docker.zip + +COPY src /home/app/src +COPY pom.xml /home/app +RUN mvn -T 1C -f /home/app/pom.xml clean package -DskipTests -Dmaven.test.skip + + +# +# Package stage +# +FROM ghcr.io/graalvm/jdk:22.3.2 + +# Yourkit +# COPY --from=build /usr/local/ /usr/local/ +#ENV JAVA_TOOL_OPTIONS -agentpath:/usr/local/YourKit-JavaProfiler-2022.3/bin/linux-x86-64/libyjpagent.so=port=10001,listen=all + +# Remote Debugging +#ENV JAVA_TOOL_OPTIONS -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n + +COPY --from=build /home/app/target/ob-cranker-0.0.1-SNAPSHOT.jar /usr/local/lib/ob-cranker.jar +ENTRYPOINT ["java","-jar","/usr/local/lib/ob-cranker.jar"] \ No newline at end of file