Skip to content

Commit

Permalink
Use docker --memory flag for windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
David Goodwin committed Sep 10, 2021
1 parent cb0c4c3 commit 316fb68
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
]
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 316fb68

Please sign in to comment.