From 72567360a482724d1268d0f15d579fef87cbeae2 Mon Sep 17 00:00:00 2001 From: Stephane Gourichon Date: Sun, 24 Mar 2024 23:28:29 +0100 Subject: [PATCH] Script to build and start all containers. --- tools/build_and_up_all_containers.sh | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tools/build_and_up_all_containers.sh diff --git a/tools/build_and_up_all_containers.sh b/tools/build_and_up_all_containers.sh new file mode 100755 index 0000000..180f785 --- /dev/null +++ b/tools/build_and_up_all_containers.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cd -P "$(dirname "$(readlink -f "$0")" )" + +cd .. + +INFRA_ROOT="$PWD" + +RC=0 + +function fail_one() +{ + echo >&2 "FAILURE on: " "$@" + RC=$(( RC + 1 )) +} + +while IFS="" read -u 3 -r SERVICE_PATH +do + pushd "${SERVICE_PATH%/*}" + pwd + docker-compose pull || { fail_one "pull" ; continue ; } + docker-compose build --no-cache || { fail_one "build" ; continue ; } + docker-compose up -d || { fail_one "switch to newly built container" ; continue ; } + + popd +done 3< <( find . -iname "compose.yaml" ) + +echo "Overall result: $RC" +exit "$RC"