Spring PetClinic Dockerized
Demo of taking the petclinic Java app and adding the proper Docker files to make it easier for dev, test, and prod.
pet-clinic-app/Dockerfile for multi-stage building of a .jar with maven
docker-compose.yml for a full-featured Dev setup with depends_on using true "wait-for-it" style dependency startup
- This currently seems to skip startup of the
sprint-petclinic-clientfrontend, or at least missing a lot of static assets (js/css). PR's welcome (not sure if it's an app issue, or a docker build/run issue)
- Multi-stage Dockerfile with a build, security scan, and prod stage
- docker-compose.yml file with proper waiting of database startup
Other Docker and Compose Tips
Use ssh to easily control a Docker Engine on another OS
Here's an example of pointing docker and docker compose at a remote docker engine. Also works for using docker cli on host OS while docker runs in Vagrant or any VM.
DOCKER_HOST=ssh://user@host docker image ls
DOCKER_HOST=ssh://user@host docker-compose up
Enable BuildKit in Docker and Compose
This may speed up your builds and provides advanced features.
export DOCKER_BUILDKIT=1 export COMPOSE_DOCKER_CLI_BUILD=1