2022-10-24 22:02:58 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2022-11-29 15:04:03 +00:00
|
|
|
# IMPORTANT: You need to have a token on huggingface.co to be able to download the checkpoints!!!
|
|
|
|
# configure values by using env when executing build.sh f.e. `env ARCH=aarch64 ./build.sh`
|
|
|
|
|
|
|
|
source ./docker-build/env.sh \
|
|
|
|
|| echo "please execute docker-build/build.sh from repository root" \
|
|
|
|
|| exit 1
|
2022-10-24 22:02:58 +00:00
|
|
|
|
2022-11-28 17:20:25 +00:00
|
|
|
pip_requirements=${PIP_REQUIREMENTS:-requirements-lin-cuda.txt}
|
|
|
|
dockerfile=${INVOKE_DOCKERFILE:-docker-build/Dockerfile}
|
2022-10-24 22:02:58 +00:00
|
|
|
|
|
|
|
# print the settings
|
|
|
|
echo "You are using these values:"
|
2022-11-28 17:20:25 +00:00
|
|
|
echo -e "Dockerfile:\t\t ${dockerfile}"
|
|
|
|
echo -e "requirements:\t\t ${pip_requirements}"
|
2022-10-24 22:02:58 +00:00
|
|
|
echo -e "volumename:\t\t ${volumename}"
|
|
|
|
echo -e "arch:\t\t\t ${arch}"
|
|
|
|
echo -e "platform:\t\t ${platform}"
|
|
|
|
echo -e "invokeai_tag:\t\t ${invokeai_tag}\n"
|
|
|
|
|
|
|
|
if [[ -n "$(docker volume ls -f name="${volumename}" -q)" ]]; then
|
|
|
|
echo "Volume already exists"
|
2022-11-29 15:04:03 +00:00
|
|
|
echo
|
2022-10-24 22:02:58 +00:00
|
|
|
else
|
|
|
|
echo -n "createing docker volume "
|
|
|
|
docker volume create "${volumename}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build Container
|
|
|
|
docker build \
|
|
|
|
--platform="${platform}" \
|
2022-11-28 17:20:25 +00:00
|
|
|
--tag="${invokeai_tag}" \
|
|
|
|
--build-arg="PIP_REQUIREMENTS=${pip_requirements}" \
|
|
|
|
--file="${dockerfile}" \
|
2022-10-24 22:02:58 +00:00
|
|
|
.
|
2022-11-28 17:20:25 +00:00
|
|
|
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
--platform="$platform" \
|
|
|
|
--name="$project_name" \
|
|
|
|
--hostname="$project_name" \
|
|
|
|
--mount="source=$volumename,target=/data" \
|
|
|
|
--mount="type=bind,source=$HOME/.huggingface,target=/root/.huggingface" \
|
|
|
|
--env="HUGGINGFACE_TOKEN=${HUGGINGFACE_TOKEN}" \
|
2022-11-29 15:04:03 +00:00
|
|
|
--entrypoint="python3" \
|
2022-11-28 17:20:25 +00:00
|
|
|
"${invokeai_tag}" \
|
|
|
|
scripts/configure_invokeai.py --yes
|