Skip to content

alexwang19/spring-petclinic-demo

Repository files navigation

Containerising Pet Clinic app using Docker

This is a dockerized version of the original app published by Spring Boot community.

Running PetClinic app locally

Petclinic is a Spring Boot application built using Maven. It is an application designed to show how the Spring stack can be used to build simple, but powerful database-oriented applications. The official version of PetClinic demonstrates the use of Spring Boot with Spring MVC and Spring Data JPA.

How it works?

Spring boot works with MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data and control logic. It emphasizes a separation between business logic and its visualization. This "separation of concerns" provides a better division of labor and improved maintenance.We can work with the persistence or data access layer with spring-data in a simple and very fast way, without the need to create so many classes manually. Spring data comes with built-in methods below or by default that allow you to save, delete, update and/or create.

Getting Started

git clone https://github.com/dockersamples/spring-petclinic.git
cd spring-petclinic
./mvnw package
java -jar target/*.jar

You can then access petclinic here: http://localhost:8080/

image

The applications allows you to perform the following set of functions:

  • Add Pets
  • Add Owners
  • Finding Owners
  • Finding Veterinarians
  • Exceptional handling

Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this):

./mvnw spring-boot:run

NOTE: Windows users should set git config core.autocrlf true to avoid format assertions failing the build (use --global to set that flag globally).

NOTE: If you prefer to use Gradle, you can build the app using ./gradlew build and look for the jar file in build/libs.

Building a Container

 docker build -t petclinic-app . -f Dockerfile

Multi-Stage Build

 docker build -t petclinic-app . -f Dockerfile.multi

Using Docker Compose

 docker-compose up -d

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published