From 296060db6389c6417b65e7a9a62cd91096c588ac Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Thu, 7 Dec 2023 11:17:11 -0500 Subject: [PATCH] Add cpu and rocm profiles. Let invokeai-nvidia service be the default. --- docker/docker-compose.yml | 10 +++++++--- docker/run.sh | 10 ++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index a5f324f746..b6a965d120 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -37,9 +37,6 @@ x-invokeai: &invokeai # invokeai-nodes-web --host 0.0.0.0 services: - invokeai-cpu: - <<: *invokeai - invokeai-nvidia: <<: *invokeai deploy: @@ -50,8 +47,15 @@ services: count: 1 capabilities: [gpu] + invokeai-cpu: + <<: *invokeai + profiles: + - cpu + invokeai-rocm: <<: *invokeai devices: - /dev/kfd:/dev/kfd - /dev/dri:/dev/dri + profiles: + - rocm diff --git a/docker/run.sh b/docker/run.sh index 950b653a53..4fe1bf4237 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -6,11 +6,13 @@ run() { cd "$scriptdir" || exit 1 local build_args="" - local service_name="invokeai-cpu" + local profile="" [[ -f ".env" ]] && - build_args=$(awk '$1 ~ /=[^$]/ {print "--build-arg " $0 " "}' .env) && - service_name="invokeai-$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)" + build_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) && + profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)" + + local service_name="invokeai-$profile" printf "%s\n" "docker compose build args:" printf "%s\n" "$build_args" @@ -19,7 +21,7 @@ run() { unset build_args printf "%s\n" "starting service $service_name" - docker compose up -d $service_name + docker compose --profile "$profile" up -d "$service_name" docker compose logs -f }