unified and reworked docker container actions

This commit is contained in:
fabian 2023-02-26 20:45:39 +01:00
parent 99d177099a
commit 64f10c1350
3 changed files with 28 additions and 34 deletions

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -euo pipefail
upDownContainers() {
# evaluate options through given arguments
docker_root=~/docker;
while [[ $# > 0 ]]; do
case $1 in
-d | --dir) docker_root=$2; shift 2;;
* ) break ;; # Anything else stops command line processing.
esac
done
for subdir in $docker_root/*; do
if [[ !(-d $subdir) ]]; then
continue;
fi
cd $subdir;
docker-compose $@;
done
}

View File

@ -1,19 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
if [[ $# > 0 ]]; then source ./dockerContainerAction.sh
DOCKER_ROOT=$1;
else
DOCKER_ROOT=$(pwd);
fi
# echo $DOCKER_ROOT;
for subdir in $DOCKER_ROOT/*; do # FIXME!!! implement possibility to pass down directory
if [[ !(-d $subdir) || ${subdir##*/} == "matrix_synapse" || ${subdir##*/} == "pydio_cells" || ${subdir##*/} == "mattermost" ]]; then upDownContainers down
continue;
fi
# echo $subdir;
cd $subdir;
# echo $(pwd);
docker-compose down;
done

View File

@ -1,23 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# evaluate options through given arguments source ./dockerContainerAction.sh
docker_root=
while [[ $# > 0 ]]; do
case $1 in
-d | --dir) docker_root=$2; shift 2;;
* ) break ;; # Anything else stops command line processing.
esac
done
if [[ -z $docker_root ]]; then # FIXME!!! implement possibility to pass down directory
docker_root=~/docker; upDownContainers up -d
fi
for subdir in $docker_root/*; do
if [[ !(-d $subdir) ]]; then
continue;
fi
cd $subdir;
docker-compose up -d;
done