2022-10-24 22:03:48 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-12-23 08:10:18 +00:00
|
|
|
set -e -o pipefail
|
2022-10-24 22:03:48 +00:00
|
|
|
|
2023-10-30 20:53:02 +00:00
|
|
|
run() {
|
|
|
|
local scriptdir=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
cd "$scriptdir" || exit 1
|
2023-10-19 15:25:47 +00:00
|
|
|
|
2023-10-30 20:53:02 +00:00
|
|
|
local build_args=""
|
2023-12-07 16:17:11 +00:00
|
|
|
local profile=""
|
2022-12-16 12:53:37 +00:00
|
|
|
|
2023-12-23 08:10:18 +00:00
|
|
|
touch .env
|
|
|
|
build_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) &&
|
|
|
|
profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)"
|
|
|
|
|
|
|
|
[[ -z "$profile" ]] && profile="nvidia"
|
2023-12-07 16:17:11 +00:00
|
|
|
|
|
|
|
local service_name="invokeai-$profile"
|
2023-10-30 20:53:02 +00:00
|
|
|
|
2023-12-23 08:10:18 +00:00
|
|
|
if [[ ! -z "$build_args" ]]; then
|
|
|
|
printf "%s\n" "docker compose build args:"
|
|
|
|
printf "%s\n" "$build_args"
|
|
|
|
fi
|
2023-10-30 20:53:02 +00:00
|
|
|
|
2024-02-13 21:01:30 +00:00
|
|
|
docker compose build $build_args $service_name
|
2023-10-30 20:53:02 +00:00
|
|
|
unset build_args
|
|
|
|
|
|
|
|
printf "%s\n" "starting service $service_name"
|
2023-12-07 16:17:11 +00:00
|
|
|
docker compose --profile "$profile" up -d "$service_name"
|
2023-10-30 20:53:02 +00:00
|
|
|
docker compose logs -f
|
|
|
|
}
|
|
|
|
|
|
|
|
run
|