echo -e "\nBuilding the docker image and running the containers..\n"
sudo docker --version || handle_error "Docker was not found!"3
(sudo mkdir -p "$HOME"/tmp/config && sudo cp ./src/main/resources/application.yml "$HOME"/tmp/config)||true# This also replaces an existing "application.yml".
sudo mkdir -p "$HOME"/logs ||true
# Run in "detached mode" -d (in the background).
(sudo docker compose up --build -d &&echo -e "\nThe pdf_aggregation_statistics docker-container started running.\n")|| handle_error "Could not build and/or run the 'pdf_aggregation_statistics' docker container!"4
sudo docker logs -f pdf_aggregation_statistics || handle_error "Could not get the logs of docker-container \"pdf_aggregation_statistics\"!"7# Using "regex anchors" to avoid false-positives. Works even if the container is not running, thus showing the error-log.
# Use just the container-name and the "-f" parameter to indicate that we want to follow on logs updates, until we specify to unfollow them (with ctrl+c).
# This way we do not need to run the "docker logs" again and again, not checking the the container-id each time.