Skip to content

Instantly share code, notes, and snippets.

@anjilinux
Forked from Musinux/Dockerfile
Created April 16, 2023 11:08
Show Gist options
  • Select an option

  • Save anjilinux/7e8e01507c936930485af924ef8f1b4e to your computer and use it in GitHub Desktop.

Select an option

Save anjilinux/7e8e01507c936930485af924ef8f1b4e 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