@@ -18,6 +18,7 @@ package compose
1818
1919import (
2020 "context"
21+ "fmt"
2122 "os"
2223
2324 "github.com/compose-spec/compose-go/types"
@@ -35,6 +36,8 @@ type buildOptions struct {
3536 pull bool
3637 progress string
3738 args []string
39+ noCache bool
40+ memory string
3841}
3942
4043func buildCommand (p * projectOptions ) * cobra.Command {
@@ -45,6 +48,9 @@ func buildCommand(p *projectOptions) *cobra.Command {
4548 Use : "build [SERVICE...]" ,
4649 Short : "Build or rebuild services" ,
4750 RunE : func (cmd * cobra.Command , args []string ) error {
51+ if opts .memory != "" {
52+ fmt .Println ("WARNING --memory is ignored as not supported in buildkit." )
53+ }
4854 if opts .quiet {
4955 devnull , err := os .Open (os .DevNull )
5056 if err != nil {
@@ -65,6 +71,11 @@ func buildCommand(p *projectOptions) *cobra.Command {
6571 cmd .Flags ().MarkHidden ("compress" ) //nolint:errcheck
6672 cmd .Flags ().Bool ("force-rm" , true , "Always remove intermediate containers. DEPRECATED" )
6773 cmd .Flags ().MarkHidden ("force-rm" ) //nolint:errcheck
74+ cmd .Flags ().BoolVar (& opts .noCache , "no-cache" , false , "Do not use cache when building the image" )
75+ cmd .Flags ().Bool ("no-rm" , false , "Do not remove intermediate containers after a successful build. DEPRECATED" )
76+ cmd .Flags ().MarkHidden ("no-rm" ) //nolint:errcheck
77+ cmd .Flags ().StringVarP (& opts .memory , "memory" , "m" , "" , "Set memory limit for the build container. Not supported on buildkit yet." )
78+ cmd .Flags ().MarkHidden ("memory" ) //nolint:errcheck
6879
6980 return cmd
7081}
@@ -85,6 +96,7 @@ func runBuild(ctx context.Context, opts buildOptions, services []string) error {
8596 Pull : opts .pull ,
8697 Progress : opts .progress ,
8798 Args : types .NewMapping (opts .args ),
99+ NoCache : opts .noCache ,
88100 })
89101 })
90102 return err
0 commit comments