Add support for build labels in 2.1 and 2.2 format

Add cache_from in 2.2 format

Add integration test for build labels

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-05-23 15:53:06 -07:00 committed by Joffrey F
parent f6aa53ea6c
commit 5fb7675055
3 changed files with 20 additions and 2 deletions

View File

@ -58,7 +58,8 @@
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
"args": {"$ref": "#/definitions/list_or_dict"},
"labels": {"$ref": "#/definitions/list_or_dict"}
},
"additionalProperties": false
}

View File

@ -58,7 +58,9 @@
"properties": {
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"}
"args": {"$ref": "#/definitions/list_or_dict"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"cache_from": {"$ref": "#/definitions/list_of_strings"}
},
"additionalProperties": false
}

View File

@ -666,6 +666,21 @@ class ServiceTest(DockerClientTestCase):
assert service.image()
assert "build_version=2" in service.image()['ContainerConfig']['Cmd']
def test_build_with_build_labels(self):
base_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, base_dir)
with open(os.path.join(base_dir, 'Dockerfile'), 'w') as f:
f.write('FROM busybox\n')
service = self.create_service('buildlabels', build={
'context': text_type(base_dir),
'labels': {'com.docker.compose.test': 'true'}
})
service.build()
assert service.image()
assert service.image()['Config']['Labels']['com.docker.compose.test'] == 'true'
def test_start_container_stays_unprivileged(self):
service = self.create_service('web')
container = create_and_start_container(service).inspect()