Last active
June 5, 2018 17:50
-
-
Save mdeterman/aa1f45a9c1b3cbb79eff9adecd3a576e to your computer and use it in GitHub Desktop.
Dockerfile for Springboot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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