Documentation ¶
Index ¶
Constants ¶
View Source
const (
DEFAULTPORT = "8088"
)
Variables ¶
View Source
var RootCmd = &cobra.Command{
Use: "dockerfile-builder",
Short: "A brief description of your application",
Long: `A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
}
RootCmd represents the base command when called without any subcommands
View Source
var UploadCmd = &cobra.Command{ Use: "upload <path to Dockerfile> -n <Docker image name> -u <Docker Hub user ID> -p <Docker Hub password>", Short: "Build the docker image and upload to Docker Hub", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { dockerFilePath := args[0] if !com.IsFile(dockerFilePath) { fmt.Println("ERROR:: cannot find the dockerfile in %v ", dockerFilePath) return errors.Errorf("cannot find the dockerfile in %v", dockerFilePath) } dockerFileBts, err := ioutil.ReadFile(dockerFilePath) if err != nil { fmt.Println("ERROR: unable to read %v", dockerFilePath) return errors.Wrapf(err, "unable to read %v", dockerFilePath) } zippedDockerFileBts, err := toZip(dockerFileBts) if err != nil { fmt.Println("ERROR: unable to zip %v", dockerFilePath) return errors.Wrapf(err, "unable to zip %v", dockerFilePath) } dockerFile := base64.StdEncoding.EncodeToString(zippedDockerFileBts) server.SetServerArch(arch) return server.UploadCmd(dockerImageName, dockerFile, userName, password) }, }
UploadCmd represents the upload command
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.