Browse code

* Builder: upload progress bar

Fix progress bar

Solomon Hykes authored on 2013/06/18 10:26:41
Showing 2 changed files
... ...
@@ -34,3 +34,4 @@ to put them - so we put them here :)
34 34
 * Caching after an ADD
35 35
 * entry point config
36 36
 * bring back git revision info, looks like it was lost
37
+* Clean up the ProgressReader api, it's a PITA to use
... ...
@@ -185,10 +185,14 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
185 185
 	if err != nil {
186 186
 		return err
187 187
 	}
188
+	// Setup an upload progress bar
189
+	// FIXME: ProgressReader shouldn't be this annoyning to use
190
+	sf := utils.NewStreamFormatter(false)
191
+	body := utils.ProgressReader(ioutil.NopCloser(context), 0, os.Stderr, sf.FormatProgress("Uploading context", "%v bytes%0.0s%0.0s"), sf)
188 192
 	// Upload the build context
189 193
 	v := &url.Values{}
190 194
 	v.Set("t", *tag)
191
-	req, err := http.NewRequest("POST", fmt.Sprintf("http://%s:%d%s?%s", cli.host, cli.port, "/build", v.Encode()), context)
195
+	req, err := http.NewRequest("POST", fmt.Sprintf("http://%s:%d%s?%s", cli.host, cli.port, "/build", v.Encode()), body)
192 196
 	if err != nil {
193 197
 		return err
194 198
 	}