docker-register-manager/cmd/push.go

23 lines
467 B
Go

package cmd
import (
"fmt"
"gitea.stuzer.link/stuzer05/docker-registry-manager/internal/app"
"os"
"os/exec"
"strings"
)
func RegistryPush(app *app.App, imageName string) {
if !strings.HasPrefix(imageName, app.RegistryName) {
imageName = app.RegistryName + "/" + imageName
}
cmd := exec.Command("docker", "push", imageName)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Println("Error pushing image:", err)
}
}