This is a quick tech demo to integrate the buzzwords of the day: Spring Boot, Docker and Microservices.
- This has been tested on various Macs and should work on all Unixes supported by Gradle/Docker
- The Dockerfile currently installs a Java7 VM so you can't compile for Java8
- There's no support for Windows since I don't have easy access to machines. Therefore, there's no gradlew.bat file to not raise false hopes.
- Docker
- almost self contained (just add docker)
- up in 5 secs
- no provisioning framework (puppet, chef, etc.)
- rebuilt in 10 secs
# 1. Build the Spring Boot app
./gradlew build
# 2. builds the docker image
docker build -t 'spring-boot' .
# 3. run the docker image, exposing the port 8080 to our host
DOCKER_ID=$(docker run -p 8080:8080 -d spring-boot)
# 4. Try it!
curl http://127.0.0.1:8080
# 5. Kill it!
docker kill $DOCKER_ID
If you're using boot2docker (e.g. you're a Mac user and running docker itself in a VM), your port redirects end up in the VM and will not be visible on your host. This script helps. The original issue is here.