28 lines
681 B
Bash

#!/usr/bin/env bash
set -euo pipefail
# Always execute relative to this script directory
cd "$(dirname "$0")"
# Charger les variables depuis .env s'il existe
if [[ -f ".env" ]]; then
# shellcheck disable=SC1091
source .env
fi
REGISTRY_HOST="${REGISTRY_HOST:-docker-registry.dev.home}"
REGISTRY_PORT="${REGISTRY_PORT:-5000}"
IMAGE_NAME="${IMAGE_NAME:-homelab-automation-api}"
REGISTRY="${REGISTRY_HOST}:${REGISTRY_PORT}"
IMAGE="${IMAGE_NAME}:latest"
# Pull latest image from private registry
docker image pull "${REGISTRY}/${IMAGE}"
# Restart stack with the current compose file
docker compose down
docker compose up -d
echo "Homelab Automation API updated and running."