فهرست منبع

* Builder: upload progress bar

Fix progress bar
Solomon Hykes 12 سال پیش
والد
کامیت
0809f649d3
2فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 1 0
      FIXME
  2. 5 1
      commands.go

+ 1 - 0
FIXME

@@ -34,3 +34,4 @@ to put them - so we put them here :)
 * Caching after an ADD
 * entry point config
 * bring back git revision info, looks like it was lost
+* Clean up the ProgressReader api, it's a PITA to use

+ 5 - 1
commands.go

@@ -185,10 +185,14 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
 	if err != nil {
 		return err
 	}
+	// Setup an upload progress bar
+	// FIXME: ProgressReader shouldn't be this annoyning to use
+	sf := utils.NewStreamFormatter(false)
+	body := utils.ProgressReader(ioutil.NopCloser(context), 0, os.Stderr, sf.FormatProgress("Uploading context", "%v bytes%0.0s%0.0s"), sf)
 	// Upload the build context
 	v := &url.Values{}
 	v.Set("t", *tag)
-	req, err := http.NewRequest("POST", fmt.Sprintf("http://%s:%d%s?%s", cli.host, cli.port, "/build", v.Encode()), context)
+	req, err := http.NewRequest("POST", fmt.Sprintf("http://%s:%d%s?%s", cli.host, cli.port, "/build", v.Encode()), body)
 	if err != nil {
 		return err
 	}