Adds support for a memory flag to docker-compose build.

Signed-off-by: Samantha Miller <samantha.a.miller123@gmail.com>
This commit is contained in:
Samantha Miller 2017-11-24 22:53:48 -06:00
parent d48002a09d
commit a6cdd62726
9 changed files with 29 additions and 4 deletions

View file

@ -584,6 +584,12 @@ class CLITestCase(DockerClientTestCase):
result = self.dispatch(['build', '--no-cache'], None)
assert 'shm_size: 96' in result.stdout
def test_build_memory_build_option(self):
pull_busybox(self.client)
self.base_dir = 'tests/fixtures/build-memory'
result = self.dispatch(['build', '--no-cache', '--memory', '96m', 'service'], None)
assert 'memory: 100663296' in result.stdout # 96 * 1024 * 1024
def test_bundle_with_digests(self):
self.base_dir = 'tests/fixtures/bundle-with-digests/'
tmpdir = pytest.ensuretemp('cli_test_bundle')

View file

@ -0,0 +1,4 @@
FROM busybox
# Report the memory (through the size of the group memory)
RUN echo "memory:" $(cat /sys/fs/cgroup/memory/memory.limit_in_bytes)

View file

@ -0,0 +1,6 @@
version: '3.5'
services:
service:
build:
context: .

View file

@ -499,6 +499,7 @@ class ServiceTest(unittest.TestCase):
target=None,
shmsize=None,
extra_hosts=None,
container_limits={'memory': None},
)
def test_ensure_image_exists_no_build(self):
@ -541,6 +542,7 @@ class ServiceTest(unittest.TestCase):
target=None,
shmsize=None,
extra_hosts=None,
container_limits={'memory': None},
)
def test_build_does_not_pull(self):