Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablohdzvizcarra/ebaa74b9b965ab5c4e92b880578e692a to your computer and use it in GitHub Desktop.
Save pablohdzvizcarra/ebaa74b9b965ab5c4e92b880578e692a to your computer and use it in GitHub Desktop.
dockerfile to app java with compile and run
# Build Stage
FROM maven:3.8.1-openjdk-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/name-file-1.0-SNAPSHOT.jar /usr/local/lib/demo.jar
ENV PORT=8080
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