This commit is contained in:
Your Name
2025-04-25 12:59:06 +12:00
parent 2f3135053f
commit 0b5fea7b71
6 changed files with 20 additions and 12 deletions

21
templates/watchtower/install.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
source "$(dirname "$0")/_common.sh"
load_env "$1" || die "Failed to load environment variables"
# Required environment variables
check_required_env_vars "CONTAINER_NAME" "IMAGE_REGISTRY" "IMAGE_REPO" "IMAGE_TAG"
# Test Docker
_check_docker_installed || die "Docker test failed, aborting installation..."
# check can pull image on remote host and exit if fails
echo "Pulling image ${IMAGE_REGISTRY}/${IMAGE_REPO}:${IMAGE_TAG}"
docker pull "$IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG" || die "Failed to pull image $IMAGE_REGISTRY/$IMAGE_REPO:$IMAGE_TAG"
# remove and restart, as the env may have changed.
echo "Removing old container ${CONTAINER_NAME}"
_remove_container $CONTAINER_NAME || die "Failed to remove container ${CONTAINER_NAME}"
echo "Starting container ${CONTAINER_NAME}"
bash ./start.sh $1 || die "Failed to start container ${CONTAINER_NAME}"
echo "Installation of ${CONTAINER_NAME} complete"