File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,15 @@ COPY pom.xml .
1818RUN mvn dependency:go-offline
1919
2020COPY src src
21- RUN mvn package -Dmaven.test.skip=true
21+ RUN mvn package -Dmaven.test.skip=true
22+ # compute the created jar name and put it in a known location to copy to the next layer.
23+ # If the user changes pom.xml to have a different version, or artifactId, this will find the jar
24+ RUN grep version /build/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-version
25+ RUN grep artifactId /build/target/maven-archiver/pom.properties | cut -d '=' -f2 >.env-id
26+ RUN mv /build/target/$(cat .env-id)-$(cat .env-version).jar /build/target/export-run-artifact.jar
2227
2328FROM openjdk:11-jdk
24- COPY --from=0 /build/target/demo-0.0.1-SNAPSHOT .jar /app/target/demo-0.0.1-SNAPSHOT .jar
29+ COPY --from=0 /build/target/export-run-artifact .jar /app/target/export-run-artifact .jar
2530
2631EXPOSE 8081
27- ENTRYPOINT [ "java" , "-jar" , "/app/target/demo-0.0.1-SNAPSHOT .jar" , "--server.port=8081" ]
32+ ENTRYPOINT [ "java" , "-jar" , "/app/target/export-run-artifact .jar" , "--server.port=8081" ]
You can’t perform that action at this time.
0 commit comments