diff --git a/docker-compose.yml b/docker-compose.yml index 5a5895d..535e8c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/up.sh b/up.sh index 32f09ab..af7c894 100755 --- a/up.sh +++ b/up.sh @@ -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."