Skip to content

Instantly share code, notes, and snippets.

@myclau
Last active June 2, 2020 08:42
Show Gist options
  • Save myclau/bd1ce583238e25e3778b1c8697401b94 to your computer and use it in GitHub Desktop.
Save myclau/bd1ce583238e25e3778b1c8697401b94 to your computer and use it in GitHub Desktop.
maven docker build image sample
#
# Build stage
#
FROM maven:3.6.0-jdk-11-slim AS build
COPY src /home/app/src
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean package
#
# Package stage
#
FROM openjdk:11-jre-slim
COPY --from=build /home/app/target/demo-0.0.1-SNAPSHOT.jar /usr/local/lib/demo.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/usr/local/lib/demo.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment