41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
IFS=$'\n\t'
|
|
|
|
echo "[$(date '+%F %T')] Starting updateDockerImages.sh"
|
|
|
|
BASE="/DATA01/dockers"
|
|
SERVICES=(adguardhome caddy filebrowser freshrss gitea immich nextcloud storj)
|
|
|
|
# require Docker Compose v2 (`docker compose`)
|
|
if ! docker compose version >/dev/null 2>&1; then
|
|
echo "docker compose (v2) not available. Install/enable it." >&2
|
|
exit 1
|
|
fi
|
|
|
|
run_compose() {
|
|
docker compose "$@"
|
|
}
|
|
|
|
for svc in "${SERVICES[@]}"; do
|
|
dir="$BASE/$svc"
|
|
if [ ! -d "$dir" ]; then
|
|
echo "Skipping $svc: directory not found: $dir"
|
|
continue
|
|
fi
|
|
|
|
echo "==> Updating $svc (dir: $dir)"
|
|
pushd "$dir" >/dev/null || { echo "pushd failed for $dir" >&2; continue; }
|
|
|
|
# stop if desired (warning only)
|
|
run_compose down || echo "Warning: 'down' failed for $svc"
|
|
|
|
# pull then bring up (handle per-service failures and continue)
|
|
run_compose pull || { echo "Error: 'pull' failed for $svc" >&2; popd >/dev/null; continue; }
|
|
run_compose up -d || { echo "Error: 'up -d' failed for $svc" >&2; popd >/dev/null; continue; }
|
|
|
|
popd >/dev/null
|
|
done
|
|
|
|
echo "[$(date '+%F %T')] Finished updateDockerImages.sh"
|