Skip to content

Instantly share code, notes, and snippets.

@Musinux
Created January 19, 2021 13:35
Show Gist options
  • Save Musinux/f4be6a64950750c7c0053b043e7a4523 to your computer and use it in GitHub Desktop.
Save Musinux/f4be6a64950750c7c0053b043e7a4523 to your computer and use it in GitHub Desktop.
Dockerfile for building a java application
FROM maven:3.6.3-openjdk-16-slim
WORKDIR /app
COPY . /app
RUN mvn clean package
# copy the packaged jar file into our docker image
RUN cp target/*-SNAPSHOT.jar /app/app.jar
# set the startup command to execute the jar
CMD ["java", "-jar", "/app/app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment