Skip to content

Instantly share code, notes, and snippets.

@mdeterman
Last active June 5, 2018 17:50
Show Gist options
  • Save mdeterman/aa1f45a9c1b3cbb79eff9adecd3a576e to your computer and use it in GitHub Desktop.
Save mdeterman/aa1f45a9c1b3cbb79eff9adecd3a576e to your computer and use it in GitHub Desktop.
Dockerfile for Springboot
FROM openjdk:8-jdk
ARG ARTIFACT_NAME
ARG SERVER_PORT=8080
ARG MANAGEMENT_PORT=8000
ENV SERVER_PORT ${SERVER_PORT}
ENV MANAGEMENT_SERVER_PORT ${MANAGEMENT_PORT}
EXPOSE ${SERVER_PORT}
EXPOSE ${MANAGEMENT_PORT}
RUN useradd -ms /bin/bash spring
USER spring
WORKDIR /home/spring
ADD --chown=spring:spring /${ARTIFACT_NAME} app.jar
# so that it has a file modification time (Docker creates all container files in an "unmodified" state by default)
RUN sh -c 'touch app.jar'
ENTRYPOINT ["java"]
CMD ["-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment