forked from hashicorp-education/learn-consul-get-started-vms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.sh
executable file
·37 lines (30 loc) · 887 Bytes
/
config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
source ./scripts/lib/lib.sh
compose="docker compose"
if [[ $(command -v docker-compose) != "" ]]; then
>&2 echo -e "-> ${RED}docker-compose v1 detected, please use 'docker compose' commande insted of 'docker-compose'${NC}"
# compose="docker-compose" # disabled you can use docker compose by default now
fi
if [[ " $@ " == *" --build "* ]]; then
echo ${COMPOSE_PROFILES//$'\n'/' '}
${compose} -f docker-compose.yml build ${COMPOSE_PROFILES//$'\n'/' '} --no-cache
exit 0
fi
if [[ $# == 0 ]]; then
services=$(${compose} config --services)
echo ""
echo -e "-> ${L_BLUE}Config script tooling${NC}"
echo ""
echo "$0 --build"
echo ""
echo "$0 <service_name> <options>"
echo ""
echo "services:"
for service in ${services//$'\n'/' '}; do
echo -e "${ORANGE}$0 $service -h${NC}"
done
echo ""
exit 1
fi
${compose} run --rm $@
exit 0