Improve image pulling and docker-compose update in auto-update script

This commit is contained in:
Your Name 2025-03-23 20:57:42 -04:00
parent 5841012a5a
commit 8147fcaf90

View file

@ -78,6 +78,7 @@ get_current_version() {
# Update Forgejo to the latest version # Update Forgejo to the latest version
update_forgejo() { update_forgejo() {
local latest_version=$1 local latest_version=$1
local image_name="codeberg.org/forgejo/forgejo"
log "Starting Forgejo update process..." log "Starting Forgejo update process..."
@ -92,11 +93,11 @@ update_forgejo() {
# Pull the latest image # Pull the latest image
log "Pulling the latest Forgejo image..." log "Pulling the latest Forgejo image..."
docker pull "codeberg.org/forgejo/forgejo:$latest_version" docker pull "$image_name:$latest_version"
# Update the docker-compose file with the new version # Update the docker-compose file with the new version
log "Updating docker-compose.yml with the new version..." log "Updating docker-compose.yml with the new version..."
sed -i "s/codeberg.org\/forgejo\/forgejo:[0-9.]*\+*/codeberg.org\/forgejo\/forgejo:$latest_version/g" "$COMPOSE_FILE" sed -i "s|codeberg.org/forgejo/forgejo:[0-9.]*\+*|$image_name:$latest_version|g" "$COMPOSE_FILE"
# Restart Forgejo with the new version # Restart Forgejo with the new version
log "Restarting Forgejo with the new version..." log "Restarting Forgejo with the new version..."