Skip to content

Commit

Permalink
Add Dockerfile for application build and package
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
skynetcap committed Dec 27, 2023
1 parent 9e34c8b commit eaba02d
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit eaba02d

Please sign in to comment.