-
Notifications
You must be signed in to change notification settings - Fork 11
/
sdctl
executable file
·44 lines (38 loc) · 1.16 KB
/
sdctl
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
38
39
40
41
42
43
#!/usr/bin/env bash
# Quick little wrapper around docker-compose to make it easier to run the two containers.
svc_name=${1:-"webui"}
svc_action=${2:-"up"}
# get script directory and cd into it
script_dir=$(
cd -- "$(dirname "$0")" &> /dev/null
pwd -P
)
cd "${script_dir}" || exit 1
# shift service name and action off args if provided
if [[ -n ${1-} ]]; then shift; fi
if [[ -n ${1-} ]]; then shift; fi
# set compose file and override file based on service name
case "${svc_name}" in
"webui")
compose_file='docker-compose.yml'
compose_override='docker-compose.override.yml'
;;
"kohya")
compose_file='docker-compose.kohya.yml'
compose_override='docker-compose.kohya.override.yml'
;;
*)
echo "invalid service name: ${svc_name}"
exit 1
;;
esac
# print some info
echo "service: ${svc_name}"
if [[ -f ${compose_override-} ]]; then
echo "Using override file: ${compose_override}"
# run docker-compose
exec docker compose -f "${compose_file}" -f "${compose_override}" "${svc_action}" "$@"
else
# run docker-compose
exec docker compose -f "${compose_file}" "${svc_action}" "$@"
fi