Skip to content

Instantly share code, notes, and snippets.

@eyalkoren
Last active April 27, 2022 04:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eyalkoren/5c90ea7a17b793c831f1f81df06505b1 to your computer and use it in GitHub Desktop.
Save eyalkoren/5c90ea7a17b793c831f1f81df06505b1 to your computer and use it in GitHub Desktop.
Dockerfile for Spring PetClinic
#Build application stage
FROM maven:3.8.5-jdk-11
WORKDIR /usr/src/java-code
RUN git clone https://github.com/spring-projects/spring-petclinic
WORKDIR /usr/src/java-code/spring-petclinic
RUN mvn -q -B package -DskipTests
RUN mkdir /usr/src/java-app
RUN cp -v /usr/src/java-code/spring-petclinic/target/*.jar /usr/src/java-app/app.jar
# Build the application running image
FROM openjdk:11
RUN export
WORKDIR /app
COPY --from=0 /usr/src/java-app/*.jar ./
CMD java -Dserver.port=${SERVER_PORT:-}\
-Dserver.context-path=/petclinic/\
-Dspring.messages.basename=messages/messages\
-Dlogging.level.org.springframework=${LOG_LEVEL:-INFO}\
-Dsecurity.ignored=${SECURITY_IGNORED:-/**}\
-Dbasic.authentication.enabled=${AUTHENTICATION_ENABLED:-false}\
-Dserver.address=${SERVER_ADDRESS:-0.0.0.0}\
-jar /app/app.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment