This commit is contained in:
ajdunney 2023-05-17 23:59:08 +01:00
parent 52f7f898a2
commit e8ba41fdf4
2 changed files with 21 additions and 4 deletions

View file

@ -83,10 +83,21 @@ RUN \
sed -i 's/in_app_dir = .*/in_app_dir = True/g' /usr/local/lib/python3.10/site-packages/gradio/routes.py && \
git config --global --add safe.directory '*'
RUN pip install webuiapi
RUN apt-get update && \
apt-get install -y curl unzip && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install
WORKDIR ${ROOT}
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV NVIDIA_VISIBLE_DEVICES=all
ENV CLI_ARGS=""
EXPOSE 7860
ENTRYPOINT ["/docker/entrypoint.sh"]
CMD python -u webui.py --listen --port 7860 ${CLI_ARGS}
# CMD python -c "print('Hello')"
CMD python -u webui.py --api --nowebui --listen --port 7860 ${CLI_ARGS}

View file

@ -1,6 +1,7 @@
#!/bin/bash
set -Eeuo pipefail
DEPLOY_ENV=${DEPLOY_ENV:-''}
# TODO: move all mkdir -p ?
mkdir -p /data/config/auto/scripts/
@ -56,12 +57,13 @@ MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache"
for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
rm -rf "${to_path}"
if [ ! -f "$from_path" ]; then
mkdir -vp "$from_path"
fi
mkdir -vp "$(dirname "${to_path}")"
ln -sT "${from_path}" "${to_path}"
if [ ! -d "${to_path}" ]; then
mkdir -vp "$(dirname "${to_path}")"
ln -sT "${from_path}" "${to_path}"
fi
echo Mounted $(basename "${from_path}")
done
@ -71,4 +73,8 @@ if [ -f "/data/config/auto/startup.sh" ]; then
popd
fi
if [[ $DEPLOY_ENV == "AWS" ]]; then
# Fetch images and weights from S3
aws s3 cp s3://medieval-news-press/weights/StableDiffusion/ /data/StableDiffusion --recursive
fi
exec "$@"