feat(docker): improve directory handling and expand environment variable documentation

This commit is contained in:
Eugene Brodsky 2024-03-20 13:48:39 -04:00
parent b00e27b022
commit c9350f71be
2 changed files with 25 additions and 15 deletions

View File

@ -2,17 +2,25 @@
## Any environment variables supported by InvokeAI can be specified here, ## Any environment variables supported by InvokeAI can be specified here,
## in addition to the examples below. ## in addition to the examples below.
# HOST_INVOKEAI_ROOT is the path on the docker host's filesystem where InvokeAI will store data. ## INVOKEAI_ROOT is the path *on the host system* where Invoke will store its data.
# Outputs will also be stored here by default. ## It is mounted into the container and allows both containerized and non-containerized usage of Invoke.
# If relative, it will be relative to the docker directory in which the docker-compose.yml file is located # Usually this is the only variable you need to set. It can be relative or absolute.
#HOST_INVOKEAI_ROOT=../../invokeai-data
# INVOKEAI_ROOT is the path to the root of the InvokeAI repository within the container.
# INVOKEAI_ROOT=~/invokeai # INVOKEAI_ROOT=~/invokeai
# Get this value from your HuggingFace account settings page. ## HOST_INVOKEAI_ROOT and CONTAINER_INVOKEAI_ROOT can be used to control the on-host
# HUGGING_FACE_HUB_TOKEN= ## and in-container paths separately, if needed.
## HOST_INVOKEAI_ROOT is the path on the docker host's filesystem where Invoke will store data.
## If relative, it will be relative to the docker directory in which the docker-compose.yml file is located
## CONTAINER_INVOKEAI_ROOT is the path within the container where Invoke will expect to find the runtime directory.
## It MUST be absolute. There is usually no need to change this.
# HOST_INVOKEAI_ROOT=../../invokeai-data
# CONTAINER_INVOKEAI_ROOT=/invokeai
## optional variables specific to the docker setup. ## 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=nvidia #| rocm
## CONTAINER_UID can be set to the UID of the user on the host system that should own the files in the container.
# CONTAINER_UID=1000 # CONTAINER_UID=1000

View File

@ -8,22 +8,24 @@ x-invokeai: &invokeai
context: .. context: ..
dockerfile: docker/Dockerfile dockerfile: docker/Dockerfile
# variables without a default will automatically inherit from the host environment
environment:
- INVOKEAI_ROOT
- HF_HOME
# Create a .env file in the same directory as this docker-compose.yml file # Create a .env file in the same directory as this docker-compose.yml file
# and populate it with environment variables. See .env.sample # and populate it with environment variables. See .env.sample
env_file: env_file:
- .env - .env
# variables without a default will automatically inherit from the host environment
environment:
# if set, CONTAINER_INVOKEAI_ROOT will override the Invoke runtime directory location *inside* the container
- INVOKEAI_ROOT=${CONTAINER_INVOKEAI_ROOT:-/invokeai}
- HF_HOME
ports: ports:
- "${INVOKEAI_PORT:-9090}:9090" - "${INVOKEAI_PORT:-9090}:9090"
volumes: volumes:
- type: bind - type: bind
source: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}} source: ${HOST_INVOKEAI_ROOT:-${INVOKEAI_ROOT:-~/invokeai}}
target: ${INVOKEAI_ROOT:-/invokeai} target: ${CONTAINER_INVOKEAI_ROOT:-/invokeai}
bind:
create_host_path: true
- ${HF_HOME:-~/.cache/huggingface}:${HF_HOME:-/invokeai/.cache/huggingface} - ${HF_HOME:-~/.cache/huggingface}:${HF_HOME:-/invokeai/.cache/huggingface}
# - ${INVOKEAI_MODELS_DIR:-${INVOKEAI_ROOT:-/invokeai/models}} # - ${INVOKEAI_MODELS_DIR:-${INVOKEAI_ROOT:-/invokeai/models}}
# - ${INVOKEAI_MODELS_CONFIG_PATH:-${INVOKEAI_ROOT:-/invokeai/configs/models.yaml}} # - ${INVOKEAI_MODELS_CONFIG_PATH:-${INVOKEAI_ROOT:-/invokeai/configs/models.yaml}}