kopia lustrzana https://github.com/jupyterhub/repo2docker
Fix memory limits set for container image builds
rodzic
5adc4b257e
commit
ef2860371a
|
@ -523,13 +523,17 @@ class BuildPack:
|
||||||
tar.close()
|
tar.close()
|
||||||
tarf.seek(0)
|
tarf.seek(0)
|
||||||
|
|
||||||
limits = {
|
# If you work on this bit of code check the corresponding code in
|
||||||
# Always disable memory swap for building, since mostly
|
# buildpacks/docker.py where it is duplicated
|
||||||
# nothing good can come of that.
|
limits = {}
|
||||||
'memswap': -1
|
|
||||||
}
|
|
||||||
if memory_limit:
|
if memory_limit:
|
||||||
limits['memory'] = memory_limit
|
# We'd like to always disable swap but all we can do is set the
|
||||||
|
# total amount. This means we only limit it when the caller set
|
||||||
|
# a memory limit
|
||||||
|
limits = {
|
||||||
|
'memory': memory_limit,
|
||||||
|
'memswap': memory_limit + 1
|
||||||
|
}
|
||||||
|
|
||||||
build_kwargs = dict(
|
build_kwargs = dict(
|
||||||
fileobj=tarf,
|
fileobj=tarf,
|
||||||
|
|
|
@ -21,13 +21,17 @@ class DockerBuildPack(BuildPack):
|
||||||
|
|
||||||
def build(self, client, image_spec, memory_limit, build_args, cache_from, extra_build_kwargs):
|
def build(self, client, image_spec, memory_limit, build_args, cache_from, extra_build_kwargs):
|
||||||
"""Build a Docker image based on the Dockerfile in the source repo."""
|
"""Build a Docker image based on the Dockerfile in the source repo."""
|
||||||
limits = {
|
# If you work on this bit of code check the corresponding code in
|
||||||
# Always disable memory swap for building, since mostly
|
# buildpacks/base.py where it is duplicated
|
||||||
# nothing good can come of that.
|
limits = {}
|
||||||
'memswap': -1
|
|
||||||
}
|
|
||||||
if memory_limit:
|
if memory_limit:
|
||||||
limits['memory'] = memory_limit
|
# We'd like to always disable swap but all we can do is set the
|
||||||
|
# total amount. This means we onnly limit it when the caller set
|
||||||
|
# a memory limit
|
||||||
|
limits = {
|
||||||
|
'memory': memory_limit,
|
||||||
|
'memswap': memory_limit + 1
|
||||||
|
}
|
||||||
|
|
||||||
build_kwargs = dict(
|
build_kwargs = dict(
|
||||||
path=os.getcwd(),
|
path=os.getcwd(),
|
||||||
|
|
Ładowanie…
Reference in New Issue