docker-register-manager/cmd/push.go

23 lines
467 B
Go
Raw Permalink Normal View History

2024-09-30 19:31:22 +03:00
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)
}
}