@@ -39,9 +39,9 @@ type buildOptions struct {
39
39
func Cmd (dockerCli command.Cli ) * cobra.Command {
40
40
var opts buildOptions
41
41
cmd := & cobra.Command {
42
- Use : "build [APPLICATION ] [TAG ]" ,
42
+ Use : "build [APP_NAME ] [APP_IMAGE ]" ,
43
43
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 ` ,
45
45
Args : cli .ExactArgs (2 ),
46
46
RunE : func (cmd * cobra.Command , args []string ) error {
47
47
opts .tag = args [1 ]
@@ -123,7 +123,10 @@ func runBuild(dockerCli command.Cli, application string, opt buildOptions) (refe
123
123
if err != nil {
124
124
return nil , err
125
125
}
126
- updateBundle (bundle , resp )
126
+ err = updateBundle (dockerCli , bundle , resp )
127
+ if err != nil {
128
+ return nil , err
129
+ }
127
130
128
131
if ref == nil {
129
132
if ref , err = computeDigest (bundle ); err != nil {
@@ -152,20 +155,28 @@ func checkMinimalEngineVersion(dockerCli command.Cli) error {
152
155
return nil
153
156
}
154
157
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 {
156
159
debugSolveResponses (resp )
157
160
for service , r := range resp {
158
161
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 )
159
167
if service == "com.docker.app.invocation-image" {
160
168
bundle .InvocationImages [0 ].Digest = digest
169
+ bundle .InvocationImages [0 ].Size = size
161
170
} else {
162
171
image := bundle .Images [service ]
163
172
image .ImageType = cnab .ImageTypeDocker
164
173
image .Digest = digest
174
+ image .Size = size
165
175
bundle .Images [service ] = image
166
176
}
167
177
}
168
178
debugBundle (bundle )
179
+ return nil
169
180
}
170
181
171
182
func createInvocationImageBuildOptions (dockerCli command.Cli , app * types.App ) (build.Options , error ) {
0 commit comments