From 674f42ba9af16898cc7834084aedd9ec863dbbe7 Mon Sep 17 00:00:00 2001 From: Brandon Rising Date: Tue, 27 Jun 2023 00:33:58 -0400 Subject: [PATCH] Pass env vars as build-args, ensure node modules isn't getting passed in --- .dockerignore | 2 ++ docker/Dockerfile | 2 +- docker/build.sh | 9 ++++++++- docker/docker-compose.yml | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index 907159c12e..598a11e1eb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,5 @@ !pyproject.toml !docker/docker-entrypoint.sh !LICENSE + +node_modules \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index df2ac4bb0f..eff558563f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -21,7 +21,7 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH" ARG TORCH_VERSION=2.0.1 ARG TORCHVISION_VERSION=0.15.2 ARG GPU_DRIVER=cuda -ARG TARGETPLATFORM +ARG TARGETPLATFORM="linux/amd64" # unused but available ARG BUILDPLATFORM diff --git a/docker/build.sh b/docker/build.sh index abca29f684..41745f02bb 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,4 +1,11 @@ #!/usr/bin/env bash set -e -docker-compose build +build_args="" + +[[ -f ".env" ]] && build_args=$(awk '$1 ~ /\=/ {print "--build-arg " $0 " "}' .env) + +echo "docker-compose build args:" +echo $build_args + +docker-compose build $build_args diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b3e101430d..85deac428e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -34,6 +34,8 @@ services: volumes: - ${INVOKEAI_ROOT:-~/invokeai}:${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}} tty: true stdin_open: true