From 5413bf07e280197792dc07843ce1537b73fa11d4 Mon Sep 17 00:00:00 2001 From: David Sisco Date: Tue, 2 Jan 2024 05:17:57 -0800 Subject: [PATCH] Sisco/docker allow relative paths for invokeai data (#5344) * Update docker-compose.yml to bind local data path * Update LOCAL_DATA_PATH in .env.sample * Add fallback to INVOKEAI_ROOT envar if LOCAL_DATA_PATH not present. * rename LOCAL_DATA_PATH to INVOKAI_LOCAL_ROOT * Whoops, didnt mean to include this * Update docker/docker-compose.yml Co-authored-by: Eugene Brodsky * [chore] rename envar * Apply suggestions from code review --------- Co-authored-by: Eugene Brodsky --- docker/.env.sample | 9 ++++++--- docker/docker-compose.yml | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docker/.env.sample b/docker/.env.sample index a9be746d63..70ecee0338 100644 --- a/docker/.env.sample +++ b/docker/.env.sample @@ -2,10 +2,13 @@ ## Any environment variables supported by InvokeAI can be specified here, ## in addition to the examples below. -# INVOKEAI_ROOT is the path to a path on the local filesystem where InvokeAI will store data. +# HOST_INVOKEAI_ROOT is the path on the docker host's filesystem where InvokeAI will store data. # Outputs will also be stored here by default. -# This **must** be an absolute path. -INVOKEAI_ROOT= +# If relative, it will be relative to the docker directory in which the docker-compose.yml file is located +#HOST_INVOKEAI_ROOT=../../invokeai-data + +# INVOKEAI_ROOT is the path to the root of the InvokeAI repository within the container. +# INVOKEAI_ROOT=~/invokeai # Get this value from your HuggingFace account settings page. # HUGGING_FACE_HUB_TOKEN= diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b6a965d120..c368eeb56d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,7 +21,9 @@ x-invokeai: &invokeai ports: - "${INVOKEAI_PORT:-9090}:9090" volumes: - - ${INVOKEAI_ROOT:-~/invokeai}:${INVOKEAI_ROOT:-/invokeai} + - type: bind + source: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}} + target: ${INVOKEAI_ROOT:-/invokeai} - ${HF_HOME:-~/.cache/huggingface}:${HF_HOME:-/invokeai/.cache/huggingface} # - ${INVOKEAI_MODELS_DIR:-${INVOKEAI_ROOT:-/invokeai/models}} # - ${INVOKEAI_MODELS_CONFIG_PATH:-${INVOKEAI_ROOT:-/invokeai/configs/models.yaml}}