66 "encoding/json"
77 "errors"
88 "fmt"
9- "io/ioutil"
109 "os"
1110 "strconv"
1211 "strings"
@@ -35,7 +34,6 @@ type buildOptions struct {
3534 progress string
3635 pull bool
3736 tag string
38- out string
3937}
4038
4139func Cmd (dockerCli command.Cli ) * cobra.Command {
@@ -60,10 +58,6 @@ func Cmd(dockerCli command.Cli) *cobra.Command {
6058 flags .StringVar (& opts .progress , "progress" , "auto" , "Set type of progress output (auto, plain, tty). Use plain to show container output" )
6159 flags .BoolVar (& opts .pull , "pull" , false , "Always attempt to pull a newer version of the image" )
6260
63- // For diagnostic and testing only
64- flags .StringVarP (& opts .out , "output" , "o" , "" , "Dump generated bundle into a file" )
65- flags .MarkHidden ("output" ) //nolint:errcheck
66-
6761 return cmd
6862}
6963
@@ -136,7 +130,7 @@ func runBuild(dockerCli command.Cli, application string, opt buildOptions) (refe
136130 }
137131 }
138132
139- if err = persistBundle ( opt , bundle , ref ); err != nil {
133+ if err = packager . PersistInBundleStore ( ref , bundle ); err != nil {
140134 return nil , err
141135 }
142136 return ref , nil
@@ -174,21 +168,6 @@ func updateBundle(bundle *bundle.Bundle, resp map[string]*client.SolveResponse)
174168 debugBundle (bundle )
175169}
176170
177- func persistBundle (opt buildOptions , bndl * bundle.Bundle , ref reference.Named ) error {
178- if opt .out != "" {
179- b , err := json .MarshalIndent (bndl , "" , " " )
180- if err != nil {
181- return err
182- }
183- if opt .out == "-" {
184- _ , err = os .Stdout .Write (b )
185- return err
186- }
187- return ioutil .WriteFile (opt .out , b , 0644 )
188- }
189- return packager .PersistInBundleStore (ref , bndl )
190- }
191-
192171func createInvocationImageBuildOptions (dockerCli command.Cli , app * types.App ) (build.Options , error ) {
193172 buildContext := bytes .NewBuffer (nil )
194173 if err := packager .PackInvocationImageContext (dockerCli , app , buildContext ); err != nil {
0 commit comments