diff --git a/docker/.env.sample b/docker/.env.sample index aeb69bfd27..eef690a808 100644 --- a/docker/.env.sample +++ b/docker/.env.sample @@ -19,8 +19,9 @@ ## INVOKEAI_PORT is the port on which the InvokeAI web interface will be available # INVOKEAI_PORT=9090 -## GPU_DRIVER can be set to either `nvidia` or `rocm` to enable GPU support in the container accordingly. -# GPU_DRIVER=nvidia #| rocm +## GPU_DRIVER can be set to either `cuda` or `rocm` to enable GPU support in the container accordingly. +# GPU_DRIVER=cuda #| rocm ## CONTAINER_UID can be set to the UID of the user on the host system that should own the files in the container. +## It is usually not necessary to change this. Use `id -u` on the host system to find the UID. # CONTAINER_UID=1000 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 2ad50e74a1..af96cc1c8f 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,7 +1,5 @@ # Copyright (c) 2023 Eugene Brodsky https://github.com/ebr -version: '3.8' - x-invokeai: &invokeai image: "local/invokeai:latest" build: @@ -32,7 +30,7 @@ x-invokeai: &invokeai services: - invokeai-nvidia: + invokeai-cuda: <<: *invokeai deploy: resources: diff --git a/docker/run.sh b/docker/run.sh index d413e53453..1040e865bf 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -8,11 +8,15 @@ run() { local build_args="" local profile="" + # create .env file if it doesn't exist, otherwise docker compose will fail touch .env + + # parse .env file for build args build_args=$(awk '$1 ~ /=[^$]/ && $0 !~ /^#/ {print "--build-arg " $0 " "}' .env) && profile="$(awk -F '=' '/GPU_DRIVER/ {print $2}' .env)" - [[ -z "$profile" ]] && profile="nvidia" + # default to 'cuda' profile + [[ -z "$profile" ]] && profile="cuda" local service_name="invokeai-$profile"