diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..159c4b493 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM maven:3.5-jdk-8-alpine +COPY . /src +WORKDIR /src +RUN mvn install + +FROM openjdk:8-jre-alpine +WORKDIR /app +EXPOSE 8080 +ENV VERSION=2.0.0.BUILD-SNAPSHOT +COPY --from=0 /src/target/spring-petclinic-$VERSION.jar /app/spring-petclinic.jar +CMD ["java", "-jar", "spring-petclinic.jar"] diff --git a/readme.md b/readme.md index 29565ec43..1ee932632 100644 --- a/readme.md +++ b/readme.md @@ -18,6 +18,20 @@ You can then access petclinic here: http://localhost:8080/ Our issue tracker is available here: https://github.com/spring-projects/spring-petclinic/issues +## Running petclinic with Docker + +Included is a multistage `Dockerfile` that will create a relatively small docker image containing Petclinic. + +```bash + git clone https://github.com/spring-projects/spring-petclinic.git + cd spring-petclinic + docker build -t spring/petclinic . + docker run -p 8080:8080 spring/petclinic +``` + +Once started you can browse to http://localhost:8080 to see the Petclinic. + + ## Database configuration In its default configuration, Petclinic uses an in-memory database (HSQLDB) which