@@ -39,9 +39,9 @@ type buildOptions struct {
3939func Cmd (dockerCli command.Cli ) * cobra.Command {
4040 var opts buildOptions
4141 cmd := & cobra.Command {
42- Use : "build [APPLICATION ] [TAG ]" ,
42+ Use : "build [APP_NAME ] [APP_IMAGE ]" ,
4343 Short : "Build service images for the application" ,
44- Example : `$ docker app build myapp.dockerapp` ,
44+ Example : `$ docker app build myapp.dockerapp my/app:1.0.0 ` ,
4545 Args : cli .ExactArgs (2 ),
4646 RunE : func (cmd * cobra.Command , args []string ) error {
4747 opts .tag = args [1 ]
@@ -123,7 +123,10 @@ func runBuild(dockerCli command.Cli, application string, opt buildOptions) (refe
123123 if err != nil {
124124 return nil , err
125125 }
126- updateBundle (bundle , resp )
126+ err = updateBundle (dockerCli , bundle , resp )
127+ if err != nil {
128+ return nil , err
129+ }
127130
128131 if ref == nil {
129132 if ref , err = computeDigest (bundle ); err != nil {
@@ -152,20 +155,28 @@ func checkMinimalEngineVersion(dockerCli command.Cli) error {
152155 return nil
153156}
154157
155- func updateBundle (bundle * bundle.Bundle , resp map [string ]* client.SolveResponse ) {
158+ func updateBundle (dockerCli command. Cli , bundle * bundle.Bundle , resp map [string ]* client.SolveResponse ) error {
156159 debugSolveResponses (resp )
157160 for service , r := range resp {
158161 digest := r .ExporterResponse ["containerimage.digest" ]
162+ inspect , _ , err := dockerCli .Client ().ImageInspectWithRaw (context .TODO (), digest )
163+ if err != nil {
164+ return err
165+ }
166+ size := uint64 (inspect .Size )
159167 if service == "com.docker.app.invocation-image" {
160168 bundle .InvocationImages [0 ].Digest = digest
169+ bundle .InvocationImages [0 ].Size = size
161170 } else {
162171 image := bundle .Images [service ]
163172 image .ImageType = cnab .ImageTypeDocker
164173 image .Digest = digest
174+ image .Size = size
165175 bundle .Images [service ] = image
166176 }
167177 }
168178 debugBundle (bundle )
179+ return nil
169180}
170181
171182func createInvocationImageBuildOptions (dockerCli command.Cli , app * types.App ) (build.Options , error ) {
0 commit comments