Ddded entrypoint.sh that will clone repo.

Repo is cloned into /sd if .git directory does not already exist there.
Also updated the name of the container image to match what I want to use
This commit is contained in:
Derek Paschal 2023-02-15 09:11:02 -06:00
parent 2515e1bf9b
commit af9c20d3b9
3 changed files with 42 additions and 10 deletions

View File

@ -1,10 +1,12 @@
FROM python:3.10
WORKDIR /sd
WORKDIR /
RUN apt update \
&& apt install -y wget git htop python3-opencv rsync
COPY ./entrypoint.sh .
EXPOSE 7860
RUN apt update \
&& apt install -y wget git htop
CMD [ "./webui.sh", "-f" ]
CMD [ "./entrypoint.sh" ]

View File

@ -1,13 +1,14 @@
version: '3.4'
services:
sd-docker:
container_name: sd-docker
image: git.exile.place/derek/sd-docker:latest
auto-sd-docker:
container_name: auto-sd-docker
image: git.exile.place/derek/auto-sd-docker:latest
restart: "no"
ports:
- "7860:7860"
volumes:
- ./:/sd
- ./sd:/sd
- "/path/to/models:/sd/models/Stable-diffusion"
deploy:
resources:
reservations:
@ -16,7 +17,7 @@ services:
device_ids: ['0']
capabilities: [gpu]
healthcheck:
test: "wget --no-verbose --tries=1 --spider http://sd-docker:7860 || exit 1"
test: "wget --no-verbose --tries=1 --spider http://auto-sd-docker:7860 || exit 1"
interval: 2m
timeout: 30s
retries: 5

29
entrypoint.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
#######################################################
# This is the entrypoint script for the app container #
#######################################################
# Determine if repo is already cloned
if [[ -d /sd/.git && -f /sd/webui.sh ]]
then
# repo already cloned
echo "Repo already cloned."
else
# clone the repo
echo "Repo missing, cloning now."
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git /repo_temp
rsync -a /repo_temp/ /sd/
rm -rf /repo_temp
fi
cd /sd
# --listen is always required while running inside a container
if [[ ! $COMMANDLINE_ARGS =~ "--listen" ]]
then
# this could still be overwritten by webui-user.sh
COMMANDLINE_ARGS="--listen ${COMMANDLINE_ARGS}"
fi
# Start webui.sh, -f flag allows running as root
./webui.sh -f