@@ -27,8 +27,9 @@ import (
2727)
2828
2929type pushOptions struct {
30- registry registryOptions
31- tag string
30+ registry registryOptions
31+ tag string
32+ platforms []string
3233}
3334
3435func pushCmd (dockerCli command.Cli ) * cobra.Command {
@@ -44,6 +45,7 @@ func pushCmd(dockerCli command.Cli) *cobra.Command {
4445 }
4546 flags := cmd .Flags ()
4647 flags .StringVarP (& opts .tag , "tag" , "t" , "" , "Target registry reference (default: <name>:<version> from metadata)" )
48+ flags .StringSliceVar (& opts .platforms , "platform" , nil , "For multi-arch service images, only push the specified platforms" )
4749 opts .registry .addFlags (flags )
4850 return cmd
4951}
@@ -95,8 +97,14 @@ func runPush(dockerCli command.Cli, name string, opts pushOptions) error {
9597 if term .IsTerminal (os .Stdout .Fd ()) {
9698 display = & interactiveDisplay {out : os .Stdout }
9799 }
100+ fixupOptions := []remotes.FixupOption {
101+ remotes .WithEventCallback (display .onEvent ),
102+ }
103+ if len (opts .platforms ) > 0 {
104+ fixupOptions = append (fixupOptions , remotes .WithComponentImagePlatforms (opts .platforms ))
105+ }
98106 // bundle fixup
99- err = remotes .FixupBundle (context .Background (), bndl , retag .cnabRef , resolverConfig , remotes . WithEventCallback ( display . onEvent ) )
107+ err = remotes .FixupBundle (context .Background (), bndl , retag .cnabRef , resolverConfig , fixupOptions ... )
100108
101109 if err != nil {
102110 return err
0 commit comments