mirror of
https://github.com/docker/compose.git
synced 2026-08-28 04:18:05 +00:00
restore support for --memory
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
dec608f3cd
commit
d01ef5887a
7 changed files with 31 additions and 22 deletions
|
|
@ -119,6 +119,8 @@ type BuildOptions struct {
|
|||
Services []string
|
||||
// Ssh authentications passed in the command line
|
||||
SSHs []types.SSHKey
|
||||
// Memory limit for the build container
|
||||
Memory int64
|
||||
}
|
||||
|
||||
// Apply mutates project according to build options
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
|
|||
} else {
|
||||
service.Build.Args = service.Build.Args.OverrideBy(args)
|
||||
}
|
||||
id, err := s.doBuildClassic(ctx, service)
|
||||
id, err := s.doBuildClassic(ctx, service, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -102,6 +102,11 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
if options.Memory != 0 {
|
||||
fmt.Fprintln(s.stderr(), "WARNING: --memory is not supported by BuildKit and will be ignored.")
|
||||
}
|
||||
|
||||
buildOptions, err := s.toBuildOptions(project, service, options)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
)
|
||||
|
||||
//nolint:gocyclo
|
||||
func (s *composeService) doBuildClassic(ctx context.Context, service types.ServiceConfig) (string, error) {
|
||||
func (s *composeService) doBuildClassic(ctx context.Context, service types.ServiceConfig, options api.BuildOptions) (string, error) {
|
||||
var (
|
||||
buildCtx io.ReadCloser
|
||||
dockerfileCtx io.ReadCloser
|
||||
|
|
@ -161,6 +161,7 @@ func (s *composeService) doBuildClassic(ctx context.Context, service types.Servi
|
|||
buildOptions.Tags = append(buildOptions.Tags, service.Image)
|
||||
buildOptions.Dockerfile = relDockerfile
|
||||
buildOptions.AuthConfigs = authConfigs
|
||||
buildOptions.Memory = options.Memory
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue