Files
hq/compose.sh
rskntroot 4b43948270 script it
2025-06-14 10:50:18 +00:00

47 lines
753 B
Bash
Executable File

#!/bin/bash
help() {
echo "Usage: compose.sh (start|stop|update)"
}
network() {
NETWORK="traefik"
if docker network ls | grep -q "${NETWORK}"; then
echo "Network ${NETWORK} already exists"
else
docker network create \
--driver bridge \
--subnet=172.20.0.0/16 \
--gateway=172.20.0.1 \
"${NETWORK}"
fi
}
dispatch() {
for dir in */; do
if [ -f "${dir}/compose.yml" ]; then
cd ${dir}
${cmd}
cd ..
fi
done
}
case "$1" in
start)
network
cmd="docker compose up -d"
dispatch
;;
stop)
cmd="docker compose down"
dispatch
;;
update)
cmd="docker compose pull"
dispatch
;;
*)
help
esac