Deploy scripts

This commit is contained in:
Tom Langan 2023-11-10 04:58:04 +00:00
parent 43e3e62f8d
commit 6e8d79085a
2 changed files with 31 additions and 2 deletions

View file

@ -30,7 +30,7 @@ services:
<<: *base_service
profiles: ["auto"]
build: ./services/AUTOMATIC1111
image: sd-auto:67
image: auto:latest
restart: always
environment:
- CLI_ARGS=--allow-code --medvram --enable-insecure-extension-access --xformers --api --listen --port 7880 --ckpt models/Stable-diffusion/sd_xl_base_1.0.safetensors

31
up.sh
View file

@ -1,3 +1,32 @@
#!/bin/bash
docker compose --profile auto up -d --build
# Stop execution if any command fails
set -e
# Define variables
SERVICE_NAME="auto"
NEW_TAG="v$(date +%s)" # Using a timestamp as the version tag for simplicity
git pull
# Build the new Docker image with the new tag
docker compose --profile download up -d --build
docker compose --profile auto build $SERVICE_NAME
# Tag the new image
docker tag $SERVICE_NAME:latest $SERVICE_NAME:$NEW_TAG
# Bring up the new containers in detached mode, without affecting the other services
docker compose --profile auto up -d --no-deps --build $SERVICE_NAME
OLD_CONTAINERS=$(docker images --filter "reference=$SERVICE_NAME" --filter "before=$SERVICE_NAME:$NEW_TAG" --format "{{.Repository}}:{{.Tag}}")
# Remove the old containers
if [ -n "$OLD_CONTAINERS" ]; then
echo "Removing old containers..."
docker rmi $OLD_CONTAINERS
fi
echo "Deployment completed successfully."