mirror of
https://github.com/AbdBarho/stable-diffusion-webui-docker.git
synced 2026-02-03 22:24:19 +01:00
33 lines
886 B
Bash
Executable file
33 lines
886 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# 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."
|
|
|