Add updateDockerImages.sh updateYtdlpForVideoTranslation.sh

This commit is contained in:
2026-04-13 16:22:50 +08:00
parent 29f98e9a78
commit cc179680f0
2 changed files with 78 additions and 0 deletions

40
updateDockerImages.sh Executable file
View File

@@ -0,0 +1,40 @@
#!/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"

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail
echo "[$(date '+%F %T')] Starting updateYtdlpForVideoTranslation.sh"
PACKAGE_DIR="/home/awin/codes/videoTranslationPackage"
HTTP_DIR="/home/awin/codes/videoTranslationHttp"
DEPLOY_DIR="/DATA01/dockers/videoTranslationHttp"
# Update yt-dlp in videoTranslationPackage and rebuild the wheel.
cd "$PACKAGE_DIR"
rm -f "$PACKAGE_DIR"/dist/*.whl "$PACKAGE_DIR"/dist/*.tar.gz
./build.sh
wheel_paths=("$PACKAGE_DIR"/dist/*.whl)
if [ "${#wheel_paths[@]}" -ne 1 ]; then
echo "[ERROR] Expected exactly one wheel in $PACKAGE_DIR/dist, found ${#wheel_paths[@]}"
exit 1
fi
wheel_path="${wheel_paths[0]}"
# Update videoTranslationPackage in videoTranslationHttp.
cd "$HTTP_DIR"
rm -f "$HTTP_DIR"/dependencies/videotranslation-*.whl
cp "$wheel_path" "$HTTP_DIR"/dependencies/
uv remove videoTranslation
uv add "$HTTP_DIR"/dependencies/$(basename "$wheel_path")
# Build docker image of videoTranslationHttp.
./build_docker.sh
# Go to docker folder and use new image.
cd "$DEPLOY_DIR"
docker compose down
docker compose up -d --force-recreate
echo "[$(date '+%F %T')] Finished updateYtdlpForVideoTranslation.sh"