Before build the docker file, build the jar package:
mvn package -DskipTests=true
Dockerfile:
FROM java:8 WORKDIR / ADD target/explorecali-2.0.0-SNAPSHOT.jar // EXPOSE 8080 ENTRYPOINT [ "java", "-jar", "/explorecali-2.0.0-SNAPSHOT.jar"]
[Docker] Create and run a Java application Docker image
原文:https://www.cnblogs.com/Answer1215/p/14199253.html