From 3350f559f7f58592c3a5b5765cf7d3ed45ed444b Mon Sep 17 00:00:00 2001 From: samuel-p Date: Mon, 19 Oct 2020 19:59:22 +0200 Subject: [PATCH] updated docker-compose-up-all.sh added docker-stack-deploy-all.sh --- docker-compose-up-all.sh | 12 ++++++++---- docker-stack-deploy-all.sh | 12 ++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 docker-stack-deploy-all.sh diff --git a/docker-compose-up-all.sh b/docker-compose-up-all.sh index 22cfbb4..c48a4f3 100644 --- a/docker-compose-up-all.sh +++ b/docker-compose-up-all.sh @@ -1,10 +1,14 @@ #!/bin/bash for dir in */; do - echo "pull $dir" - docker-compose -f "$dir/docker-compose.yml" pull - echo "up $dir" - docker-compose -f "$dir/docker-compose.yml" up --build --remove-orphans -d + service="${dir/\//}" + if [ -f "$service/docker-compose.yml" ]; then + echo "pull $service" + docker-compose -f "$service/docker-compose.yml" pull + echo "up $service" + docker-compose -f "$service/docker-compose.yml" up --build --remove-orphans -d + fi done +echo "cleanup docker" docker system prune --all --volumes --force diff --git a/docker-stack-deploy-all.sh b/docker-stack-deploy-all.sh new file mode 100644 index 0000000..b757683 --- /dev/null +++ b/docker-stack-deploy-all.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +for dir in */; do + service="${dir/\//}" + if [ -f "$service/docker-compose.yml" ]; then + echo "deploy $service" + docker stack deploy -c "$service/docker-compose.yml" "$service" + fi +done + +echo "cleanup docker" +docker system prune --all --volumes --force