This is a simple POC for:
-
docker
-
docker-compose
-
spring actuator
-
Download the source file from GITHUB: git clone https://github.com/bindstone/docker-actuator.git
-
Build it with: mvn clean install
-
Run it with: docker-compose --build up
docker-actuator-server
INSIDE BUILD: In this approach the base image is [maven:3.6-jdk-8-alpine]. It contains next to the JDK also the Maven tools. During the process to build the image, Docker will copy source in the image, download all Maven dependencies in the image repository, build the artifacts and start the server.
The image itself is bigger in size, as the dependency objects are multiple time in the image present: * maven repository, * maven build jar, * maven build jar with tomcat * …
docker-actuator-client
OUTSIDE BUILD: In this approach the base image is [openjdk:8-jdk-alpine]. During the process to build the image, only the artifact docker-actuator-client.jar will be copied in the image. This requires a preprocess by the developer or building tools like Jenkins to execute the maven build outside.
docker-actuator-client-multi
MULTI STEP BUILD: In this approach the build is done on the correct way, using a first step to creating the artifacts and a second step copying only the generated file in the final instance.
When starting the docker-compose you should access to the different server and clients.
Rest request:
-
Server: http://127.0.0.1:8888/hello
-
Client1: http://127.0.0.1:8080/hello
-
Client2: http://127.0.0.1:8081/hello
-
Client-Multi: http://127.0.0.1:8082/hello
Also accessing to Actuator: http://127.0.0.1:8888/#/wallboard
Shows you tree running services, and one client has currently 2 running instances and for the multi step build a separate.
and you can click on the services to get more details like: