github.com/unionj-cloud/go-doudou@v1.3.8-0.20221011095552-0088008e5b31/cmd/push.go (about) 1 package cmd 2 3 import ( 4 "github.com/spf13/cobra" 5 "github.com/unionj-cloud/go-doudou/cmd/internal/svc" 6 ) 7 8 var prefix string 9 10 // pushCmd pushes image to remote docker image repository 11 var pushCmd = &cobra.Command{ 12 Use: "push", 13 Short: "wrap docker build, docker tag, docker push commands and generate or update k8s deploy yaml file", 14 Long: ``, 15 Run: func(cmd *cobra.Command, args []string) { 16 s := svc.NewSvc("", svc.WithImagePrefix(prefix)) 17 s.Push(imageRepo) 18 }, 19 } 20 21 func init() { 22 svcCmd.AddCommand(pushCmd) 23 24 pushCmd.Flags().StringVar(&prefix, "pre", "", `image name prefix string used for building and pushing docker image`) 25 }