diff --git a/compose/config/config_schema_v2.1.json b/compose/config/config_schema_v2.1.json index aa59d181e..9004000ea 100644 --- a/compose/config/config_schema_v2.1.json +++ b/compose/config/config_schema_v2.1.json @@ -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 } diff --git a/compose/config/config_schema_v2.2.json b/compose/config/config_schema_v2.2.json index a585f2a8c..e8edb60ed 100644 --- a/compose/config/config_schema_v2.2.json +++ b/compose/config/config_schema_v2.2.json @@ -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 } diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index a5b5bda57..178df1323 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -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()