Created
December 18, 2022 13:46
-
-
Save koduki/72d8dd683ade81c488c49b1c32fa6939 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1st stage, build the app | |
FROM maven:3.8.4-openjdk-17-slim as build | |
WORKDIR /helidon | |
# Create a first layer to cache the "Maven World" in the local repository. | |
# Incremental docker builds will always resume after that, unless you update | |
# the pom | |
ADD pom.xml . | |
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip | |
# Do the Maven build! | |
# Incremental docker builds will resume here when you change sources | |
ADD src src | |
RUN mvn package -DskipTests | |
RUN echo "done!" | |
# 2nd stage, build the runtime image | |
FROM eclipse-temurin:17-ubi9-minimal | |
WORKDIR /helidon | |
# Copy the binary built in the 1st stage | |
COPY --from=build /helidon/target/myproject.jar ./ | |
COPY --from=build /helidon/target/libs ./libs | |
RUN timeout -s INT 5 java -XX:ArchiveClassesAtExit=mn.jsa -jar myproject.jar; echo "generate cds" | |
CMD ["java", "-XX:SharedArchiveFile=mn.jsa", "-jar", "myproject.jar"] | |
EXPOSE 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment