From: Kai Moritz Date: Sun, 23 Jun 2024 10:00:08 +0000 (+0200) Subject: If some images are missing, only the missing images are build X-Git-Tag: wordcount-2.2.1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=decd75b90f2b21cfbef1e2d144070b71d4ffde48;p=demos%2Fkafka%2Fwordcount If some images are missing, only the missing images are build --- diff --git a/README.sh b/README.sh index 12b9703..62805c6 100755 --- a/README.sh +++ b/README.sh @@ -35,26 +35,79 @@ if [[ "$1" = "build" ]] then - mvn clean package || exit - docker compose rm -svf recorder users splitter counter top10 query popular + docker compose rm -svf bart riddler nerd recorder users splitter counter top10 query popular +fi + +if [[ $(docker image ls -q $FORTUNE) == "" || "$1" = "build" ]] +then + echo "Building image $FORTUNE" ( cd fortune; ./README.sh $FORTUNE; ) - mvn -f recorder/pom.xml docker:build - mvn -f users/pom.xml docker:build - mvn -f splitter/pom.xml docker:build - mvn -f counter/pom.xml docker:build - mvn -f top10/pom.xml docker:build - mvn -f query/pom.xml docker:build - mvn -f popular/pom.xml docker:build else - echo "Using existing images:" - docker image ls $FORTUNE - docker image ls $RECORDER - docker image ls $USERS - docker image ls $SPLITTER - docker image ls $COUNTER - docker image ls $TOP10 - docker image ls $QUERY - docker image ls $POPULAR + echo -n "Using existing image for $FORTUNE: " + docker image ls --format json $FORTUNE | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $RECORDER) == "" || "$1" = "build" ]] +then + echo "Building image $RECORDER" + mvn -f recorder/pom.xml clean package docker:build +else + echo -n "Using existing image for $RECORDER: " + docker image ls --format json $RECORDER | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $USERS) == "" || "$1" = "build" ]] +then + echo "Building image $USERS" + mvn -f users/pom.xml clean package docker:build +else + echo -n "Using existing image for $USERS: " + docker image ls --format json $USERS | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $SPLITTER) == "" || "$1" = "build" ]] +then + echo "Building image $SPLITTER" + mvn -f splitter/pom.xml clean package docker:build +else + echo -n "Using existing image for $SPLITTER: " + docker image ls --format json $SPLITTER | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $COUNTER) == "" || "$1" = "build" ]] +then + echo "Building image $COUNTER" + mvn -f counter/pom.xml clean package docker:build +else + echo -n "Using existing image for $COUNTER: " + docker image ls --format json $COUNTER | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $TOP10) == "" || "$1" = "build" ]] +then + echo "Building image $TOP10" + mvn -f top10/pom.xml clean package docker:build +else + echo -n "Using existing image for $TOP10: " + docker image ls --format json $TOP10 | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $QUERY) == "" || "$1" = "build" ]] +then + echo "Building image $QUERY" + mvn -f query/pom.xml clean package docker:build +else + echo -n "Using existing image for $QUERY: " + docker image ls --format json $QUERY | jq -r '(.ID + " - " + .CreatedSince)' +fi + +if [[ $(docker image ls -q $POPULAR) == "" || "$1" = "build" ]] +then + echo "Building image $POPULAR" + mvn -f popular/pom.xml clean package docker:build +else + echo -n "Using existing image for $POPULAR: " + docker image ls --format json $POPULAR | jq -r '(.ID + " - " + .CreatedSince)' fi