mirror of https://github.com/docker/compose.git
Merge pull request #4863 from shin-/4038-build-labels-v2
Add support for build labels in 2.1 and 2.2 format
This commit is contained in:
commit
bbb771f108
|
@ -58,7 +58,8 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"context": {"type": "string"},
|
"context": {"type": "string"},
|
||||||
"dockerfile": {"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
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,9 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"context": {"type": "string"},
|
"context": {"type": "string"},
|
||||||
"dockerfile": {"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
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
@ -666,6 +666,21 @@ class ServiceTest(DockerClientTestCase):
|
||||||
assert service.image()
|
assert service.image()
|
||||||
assert "build_version=2" in service.image()['ContainerConfig']['Cmd']
|
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):
|
def test_start_container_stays_unprivileged(self):
|
||||||
service = self.create_service('web')
|
service = self.create_service('web')
|
||||||
container = create_and_start_container(service).inspect()
|
container = create_and_start_container(service).inspect()
|
||||||
|
|
Loading…
Reference in New Issue