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

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
This commit is contained in:
Guillaume Tardif 2021-03-30 15:24:36 +02:00
parent 3f0ee7072f
commit e0a828daae
1 changed files with 5 additions and 1 deletions

View File

@ -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