4.5 Running the Lab

Building the docker image for the kafka-order microservice and start the environment.

In the previous section we implemented the microservice. Let’s build and run it.

Building

The kafka-order microservice provides a multistage Dockerfile.multistage.jvm for building the java application and creating a docker container.

Task 4.5.4 - Build docker container

Change to base directory of this lab <PROJECT_ROOT>/code/kafka and run docker build.

1
docker build -f kafka-order/src/main/docker/Dockerfile.multistage.jvm -t microservices-lab-kafka-order:latest  kafka-order

Running

Task 4.5.2 - Starting with Docker Compose

Enter a shell and change your directory to the <PROJECT_ROOT>/code/kafka/docker folder.

If you have any previous lab running stop these containers

1
docker-compose down --remove-orphans

Start the microservices with

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
docker-compose up -d
Starting docker_order_1        ... done
Starting docker_stock_1        ... done
Starting docker_viewer_1       ... done
Starting debezium-kafka        ... done
Starting debezium-zookeeper    ... done
Starting docker_prometheus_1   ... done
Starting docker_grafana_1      ... done
Starting docker_alertmanager_1 ... done
Starting docker_stock-db_1     ... done
Starting docker_order-db_1     ... done
Starting docker_jaeger_1       ... done
Last modified February 12, 2024: fix debezium lab version (9e6013e)