FROM adoptopenjdk:11-jdk as app-build # This is the base image that will contain a built version of the spring-petclinic-rest # application. Installing the dependencies and maven compiling the application is time # consuming, so we do it in a base image to save time nightly. RUN apt update && apt install -y git WORKDIR /app RUN git clone http://github.com/spring-petclinic/spring-petclinic-rest.git WORKDIR /app/spring-petclinic-rest RUN ./mvnw package -Dmaven.test.skip=true RUN cp target/spring-petclinic-rest*.jar /app/spring-petclinic-rest.jar FROM adoptopenjdk:11-jre COPY --from=app-build /app/spring-petclinic-rest.jar /app/spring-petclinic-rest.jar WORKDIR /app EXPOSE 9966 CMD ["java", "-jar", "spring-petclinic-rest.jar"]