From 316fb6863b25b74b0203570b61529095b6cf69ba Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Fri, 10 Sep 2021 10:14:28 -0700 Subject: [PATCH] Use docker --memory flag for windows builds --- build.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.py b/build.py index ec358a553f..7551755356 100755 --- a/build.py +++ b/build.py @@ -947,6 +947,13 @@ def container_build(images, backends, repoagents, endpoints): '--pull', ] + # Windows docker runs in a VM and memory needs to be specified + # explicitly. + if target_platform() == 'windows': + commonargs += [ + '--memory', FLAGS.container_memory + ] + log_verbose('buildbase container {}'.format(commonargs + cachefromargs)) create_dockerfile_buildbase(FLAGS.build_dir, 'Dockerfile.buildbase', dockerfileargmap) @@ -1010,6 +1017,11 @@ def container_build(images, backends, repoagents, endpoints): '/workspace' ] if target_platform() == 'windows': + # Windows docker runs in a VM and memory needs to be + # specified explicitly. + dockerrunargs += [ + '--memory', FLAGS.container_memory + ] dockerrunargs += [ '-v', '\\\\.\pipe\docker_engine:\\\\.\pipe\docker_engine' ] @@ -1115,6 +1127,11 @@ def container_build(images, backends, repoagents, endpoints): action="store_true", required=False, help='Do not use Docker --pull argument when building container.') + parser.add_argument( + '--container-memory', + default="8g", + required=False, + help='Value for Docker --memory argument. Used only for windows builds.') parser.add_argument( '--target-platform', required=False,