feat(ota): upgrade container

This commit is contained in:
Jacky 2025-04-21 06:20:15 +00:00
parent a88f8646e6
commit e2c43be24a
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
19 changed files with 708 additions and 28 deletions

View file

@ -12,6 +12,7 @@ import (
"github.com/0xJacky/Nginx-UI/internal/cert"
"github.com/0xJacky/Nginx-UI/internal/cluster"
"github.com/0xJacky/Nginx-UI/internal/cron"
"github.com/0xJacky/Nginx-UI/internal/docker"
"github.com/0xJacky/Nginx-UI/internal/passkey"
"github.com/0xJacky/Nginx-UI/internal/validation"
"github.com/0xJacky/Nginx-UI/model"
@ -35,6 +36,7 @@ func Boot() {
InitCryptoSecret,
validation.Init,
cache.Init,
CheckAndCleanupOTAContainers,
}
syncs := []func(){
@ -129,3 +131,14 @@ func InitJsExtensionType() {
// See https://github.com/golang/go/issues/32350
_ = mime.AddExtensionType(".js", "text/javascript; charset=utf-8")
}
// CheckAndCleanupOTAContainers Check and cleanup OTA update temporary containers
func CheckAndCleanupOTAContainers() {
// Execute the third step cleanup operation at startup
err := docker.UpgradeStepThree()
if err != nil {
logger.Error("Failed to cleanup OTA containers:", err)
} else {
logger.Info("OTA container cleanup completed successfully")
}
}