diff --git a/README.md b/README.md index 5db6416..3cfb9d1 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Three commonly used ports are exposed: ### Volumes The provided example docker compose maps several volumes from the local `config` directory into the container: `loras, models, presets, prompts, training, extensions`. If these folders are empty, they will be initialised when the container is run. -Extensions will persist their state between container launches if you use the mapped folder - **but they will not automatically update when a new image is released, so this feature is disabled by default.** You must uncomment the mapping in `docker-compose.yml` to enable this extension persistence. +Extensions will persist their state between container launches if you use a mapped folder - **but they will not automatically update when a new image is released, so this feature is disabled by default.** The whole extensions folder can be mapped (all extensions are persisted) or individual extensions can be mapped one at a time. Examples are given in the `docker-compose.yml`. *If you are getting an error about missing files, try clearing these folders and letting the service re-populate them.* diff --git a/docker-compose.yml b/docker-compose.yml index d6ebfa8..350f6dc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,8 @@ services: - ./config/prompts:/app/prompts - ./config/softprompts:/app/softprompts - ./config/training:/app/training -# - ./config/extensions:/app/extensions +# - ./config/extensions:/app/extensions # Persist all extensions +# - ./config/extensions/silero_tts:/app/extensions/silero_tts # Persist a single extension logging: driver: json-file options: diff --git a/docker-compose.yml.build b/docker-compose.yml.build index 67160fb..fe31536 100644 --- a/docker-compose.yml.build +++ b/docker-compose.yml.build @@ -22,7 +22,8 @@ services: - ./config/prompts:/app/prompts - ./config/softprompts:/app/softprompts - ./config/training:/app/training -# - ./config/extensions:/app/extensions +# - ./config/extensions:/app/extensions # Persist all extensions +# - ./config/extensions/silero_tts:/app/extensions/silero_tts # Persist a single extension logging: driver: json-file options: diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index 201a4da..5897aec 100644 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -10,7 +10,7 @@ function ctrl_c { trap ctrl_c SIGTERM SIGINT SIGQUIT SIGHUP # Generate default configs if empty -CONFIG_DIRECTORIES=("loras" "models" "presets" "prompts" "training/datasets" "training/formats" "extensions") +CONFIG_DIRECTORIES=("loras" "models" "presets" "prompts" "training/datasets" "training/formats") for config_dir in "${CONFIG_DIRECTORIES[@]}"; do if [ -z "$(ls /app/"$config_dir")" ]; then echo "*** Initialising config for: '$config_dir' ***" @@ -19,6 +19,18 @@ for config_dir in "${CONFIG_DIRECTORIES[@]}"; do fi done +# Populate extension folders if empty +EXTENSIONS_SRC="/src/extensions" +EXTENSIONS_DEFAULT=($(find "$EXTENSIONS_SRC" -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)) +for extension_dir in "${EXTENSIONS_DEFAULT[@]}"; do + if [ -z "$(ls /app/extensions/"$extension_dir" 2>/dev/null)" ]; then + echo "*** Initialising extension: '$extension_dir' ***" + mkdir -p /app/extensions/"$extension_dir" + cp -ar "$EXTENSIONS_SRC"/"$extension_dir"/* /app/extensions/"$extension_dir"/ + fi + chown -R 1000:1000 /app/extensions/"$extension_dir" # Not ideal... but convenient. +done + # Runtime extension build if [[ -n "$BUILD_EXTENSIONS_LIVE" ]]; then eval "live_extensions=($BUILD_EXTENSIONS_LIVE)"