Skip to content

Instantly share code, notes, and snippets.

@dermatologist
Created October 7, 2017 14:28
Show Gist options
  • Save dermatologist/22044bbe02fa71ca9726c473fc123176 to your computer and use it in GitHub Desktop.
Save dermatologist/22044bbe02fa71ca9726c473fc123176 to your computer and use it in GitHub Desktop.
FROM java:8
# https://hub.docker.com/r/library/java/tags/
# Install maven
RUN apt-get update
RUN apt-get install -y maven
WORKDIR /code
# Prepare by downloading dependencies
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve"]
RUN ["mvn", "verify"]
# Adding source, compile and package into a fat jar
ADD src /code/src
RUN ["mvn", "package"]
EXPOSE 4567
CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "target/jar-with-dependencies.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment