浏览代码

--memory is not deprecated, but not supported on buildkit. Issue a Warning and ignore flag

Signed-off-by: Guillaume Tardif <[email protected]>
Guillaume Tardif 4 年之前
父节点
当前提交
e0a828daae
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      cli/cmd/compose/build.go

+ 5 - 1
cli/cmd/compose/build.go

@@ -18,6 +18,7 @@ package compose
 
 import (
 	"context"
+	"fmt"
 	"os"
 
 	"github.com/compose-spec/compose-go/types"
@@ -47,6 +48,9 @@ func buildCommand(p *projectOptions) *cobra.Command {
 		Use:   "build [SERVICE...]",
 		Short: "Build or rebuild services",
 		RunE: func(cmd *cobra.Command, args []string) error {
+			if opts.memory != "" {
+				fmt.Println("WARNING --memory is ignored as not supported in buildkit.")
+			}
 			if opts.quiet {
 				devnull, err := os.Open(os.DevNull)
 				if err != nil {
@@ -70,7 +74,7 @@ func buildCommand(p *projectOptions) *cobra.Command {
 	cmd.Flags().BoolVar(&opts.noCache, "no-cache", false, "Do not use cache when building the image")
 	cmd.Flags().Bool("no-rm", false, "Do not remove intermediate containers after a successful build. DEPRECATED")
 	cmd.Flags().MarkHidden("no-rm") //nolint:errcheck
-	cmd.Flags().StringVarP(&opts.memory, "memory", "m", "", "Set memory limit for the build container. DEPRECATED")
+	cmd.Flags().StringVarP(&opts.memory, "memory", "m", "", "Set memory limit for the build container. Not supported on buildkit yet.")
 	cmd.Flags().MarkHidden("memory") //nolint:errcheck
 
 	return cmd