diff --git a/.gitignore b/.gitignore index 2a011a1..51b745f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ /.devcontainer /docker-compose.override.yml +# Environment variable files +.env + # VSCode specific *.code-workspace /.vscode diff --git a/docker-compose.yml b/docker-compose.yml index f7567ee..6956ec0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,19 +1,19 @@ -version: '3.9' +version: "3.9" x-base_service: &base_service - ports: - - "7860:7860" - volumes: - - &v1 ./data:/data - - &v2 ./output:/output - stop_signal: SIGINT - deploy: - resources: - reservations: - devices: - - driver: nvidia - device_ids: ['0'] - capabilities: [gpu] + ports: + - "${HOST_PORT:-7860}:7860" + volumes: + - &v1 "${HOST_DATA_VOL:-./data}:/data" + - &v2 "${HOST_OUT_VOL:-./output}:/output" + stop_signal: SIGINT + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ["0"] + capabilities: [gpu] name: webui-docker @@ -30,14 +30,14 @@ services: build: ./services/AUTOMATIC1111 image: sd-auto:56 environment: - - CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api + - CLI_ARGS=${AUTO_CLI_ARGS:-"--allow-code --medvram --xformers --enable-insecure-extension-access --api"} auto-cpu: <<: *automatic profiles: ["auto-cpu"] deploy: {} environment: - - CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api + - CLI_ARGS=${AUTO_CPU_CLI_ARGS:-"--no-half --precision full --allow-code --enable-insecure-extension-access --api"} invoke: &invoke <<: *base_service @@ -46,14 +46,14 @@ services: image: sd-invoke:28 environment: - PRELOAD=true - - CLI_ARGS=--xformers + - CLI_ARGS=${INVOKE_CLI_ARGS:-"--xformers"} # invoke-cpu: # <<: *invoke # profiles: ["invoke-cpu"] # environment: # - PRELOAD=true - # - CLI_ARGS=--always_use_cpu + # - CLI_ARGS=${INVOKE_CPU_CLI_ARGS:-"--always_use_cpu"} comfy: &comfy <<: *base_service @@ -62,12 +62,11 @@ services: image: sd-comfy:2 tty: true environment: - - CLI_ARGS= - + - CLI_ARGS=${COMFY_CLI_ARGS:-""} comfy-cpu: <<: *comfy profiles: ["comfy-cpu"] deploy: {} environment: - - CLI_ARGS=--cpu + - CLI_ARGS=${COMFY_CPU_CLI_ARGS:-"--cpu"} diff --git a/example.env b/example.env new file mode 100644 index 0000000..c5f79da --- /dev/null +++ b/example.env @@ -0,0 +1,42 @@ +# This file lets you change default settings without editing the docker-compose.yml + +# To override settings: +# 1. Rename this file to ".env" or copy it +# 2. Uncomment the parts you want to override +# 3. to use default values, comment the line again +# Do this while the container is not running +# Don't forget to move/copy the files to the new location, if you changed mounts +# You can see the default values in docker-compose.yml + +########################## +### NETWORK ### +########################## + +## The port on your machine ## +#HOST_PORT=7860 + +########################## +### MOUNTS ### +########################## + +## Models, settings and other persistent files +#HOST_DATA_VOL=./data + +## Target path for generated images ## +#HOST_OUT_VOL=./output + +########################## +### CONTAINER SETTINGS ### +########################## + +## AUTO + AUTO using CPU ## +#AUTO_CLI_ARGS=--allow-code --medvram --xformers --enable-insecure-extension-access --api +#AUTO_CPU_CLI_ARGS=--no-half --precision full --allow-code --enable-insecure-extension-access --api + +## Invoke + Invoke using CPU ## +#INVOKE_CLI_ARGS=--xformers +#INVOKE_CPU_CLI_ARGS=--always_use_cpu + +## Comfy + Comfy using CPU ## +#COMFY_CLI_ARGS= +#COMFY_CPU_CLI_ARGS=--cpu