Compare commits
11 commits
master
...
cache_from
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c64f7dde04 | ||
|
|
33fcfca040 | ||
|
|
5b6191e653 | ||
|
|
89c028f3f2 | ||
|
|
7b1be89ec0 | ||
|
|
e4a87397af | ||
|
|
64ddd09ed1 | ||
|
|
dbe418924a | ||
|
|
c2553ac777 | ||
|
|
39b2c6636e | ||
|
|
e0e862c042 |
9 changed files with 26 additions and 7 deletions
|
|
@ -55,7 +55,7 @@ Installation and documentation
|
||||||
Contributing
|
Contributing
|
||||||
------------
|
------------
|
||||||
|
|
||||||
[](http://jenkins.dockerproject.org/job/Compose%20Master/)
|
[](https://jenkins.dockerproject.org/job/docker/job/compose/job/master/)
|
||||||
|
|
||||||
Want to help build Compose? Check out our [contributing documentation](https://github.com/docker/compose/blob/master/CONTRIBUTING.md).
|
Want to help build Compose? Check out our [contributing documentation](https://github.com/docker/compose/blob/master/CONTRIBUTING.md).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,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"},
|
||||||
|
"cache_from": {"type": "#/definitions/list_of_strings"}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -802,6 +802,7 @@ class Service(object):
|
||||||
nocache=no_cache,
|
nocache=no_cache,
|
||||||
dockerfile=build_opts.get('dockerfile', None),
|
dockerfile=build_opts.get('dockerfile', None),
|
||||||
buildargs=build_opts.get('args', None),
|
buildargs=build_opts.get('args', None),
|
||||||
|
cache_from=build_opts.get('cache_from', None),
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
|
|
||||||
__docker_compose_q() {
|
__docker_compose_q() {
|
||||||
docker-compose 2>/dev/null $daemon_options "$@"
|
docker-compose 2>/dev/null "${daemon_options[@]}" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Transforms a multiline list of strings into a single line string
|
# Transforms a multiline list of strings into a single line string
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ PyYAML==3.11
|
||||||
backports.ssl-match-hostname==3.5.0.1; python_version < '3'
|
backports.ssl-match-hostname==3.5.0.1; python_version < '3'
|
||||||
cached-property==1.2.0
|
cached-property==1.2.0
|
||||||
colorama==0.3.7
|
colorama==0.3.7
|
||||||
docker==2.0.2
|
docker==2.1.0
|
||||||
dockerpty==0.4.1
|
dockerpty==0.4.1
|
||||||
docopt==0.6.1
|
docopt==0.6.1
|
||||||
enum34==1.0.4; python_version < '3.4'
|
enum34==1.0.4; python_version < '3.4'
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class Version(namedtuple('_Version', 'major minor patch rc')):
|
||||||
version = version.lstrip('v')
|
version = version.lstrip('v')
|
||||||
version, _, rc = version.partition('-')
|
version, _, rc = version.partition('-')
|
||||||
major, minor, patch = version.split('.', 3)
|
major, minor, patch = version.split('.', 3)
|
||||||
return cls(int(major), int(minor), int(patch), rc)
|
return cls(major, minor, patch, rc)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def major_minor(self):
|
def major_minor(self):
|
||||||
|
|
@ -57,7 +57,7 @@ class Version(namedtuple('_Version', 'major minor patch rc')):
|
||||||
"""
|
"""
|
||||||
# rc releases should appear before official releases
|
# rc releases should appear before official releases
|
||||||
rc = (0, self.rc) if self.rc else (1, )
|
rc = (0, self.rc) if self.rc else (1, )
|
||||||
return (self.major, self.minor, self.patch) + rc
|
return (int(self.major), int(self.minor), int(self.patch)) + rc
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
rc = '-{}'.format(self.rc) if self.rc else ''
|
rc = '-{}'.format(self.rc) if self.rc else ''
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -37,7 +37,7 @@ install_requires = [
|
||||||
'requests >= 2.6.1, != 2.11.0, < 2.12',
|
'requests >= 2.6.1, != 2.11.0, < 2.12',
|
||||||
'texttable >= 0.8.1, < 0.9',
|
'texttable >= 0.8.1, < 0.9',
|
||||||
'websocket-client >= 0.32.0, < 1.0',
|
'websocket-client >= 0.32.0, < 1.0',
|
||||||
'docker >= 2.0.2, < 3.0',
|
'docker >= 2.1.0, < 3.0',
|
||||||
'dockerpty >= 0.4.1, < 0.5',
|
'dockerpty >= 0.4.1, < 0.5',
|
||||||
'six >= 1.3.0, < 2',
|
'six >= 1.3.0, < 2',
|
||||||
'jsonschema >= 2.5.1, < 3',
|
'jsonschema >= 2.5.1, < 3',
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ from compose.service import NetworkMode
|
||||||
from compose.service import Service
|
from compose.service import Service
|
||||||
from tests.integration.testcases import v2_1_only
|
from tests.integration.testcases import v2_1_only
|
||||||
from tests.integration.testcases import v2_only
|
from tests.integration.testcases import v2_only
|
||||||
|
from tests.integration.testcases import v3_only
|
||||||
|
|
||||||
|
|
||||||
def create_and_start_container(service, **override_options):
|
def create_and_start_container(service, **override_options):
|
||||||
|
|
@ -946,6 +947,20 @@ class ServiceTest(DockerClientTestCase):
|
||||||
}.items():
|
}.items():
|
||||||
self.assertEqual(env[k], v)
|
self.assertEqual(env[k], v)
|
||||||
|
|
||||||
|
@v3_only()
|
||||||
|
def test_build_with_cachefrom(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('cache_from',
|
||||||
|
build={'context': base_dir,
|
||||||
|
'cache_from': ['build1']})
|
||||||
|
service.build()
|
||||||
|
assert service.image()
|
||||||
|
|
||||||
@mock.patch.dict(os.environ)
|
@mock.patch.dict(os.environ)
|
||||||
def test_resolve_env(self):
|
def test_resolve_env(self):
|
||||||
os.environ['FILE_DEF'] = 'E1'
|
os.environ['FILE_DEF'] = 'E1'
|
||||||
|
|
|
||||||
|
|
@ -446,6 +446,7 @@ class ServiceTest(unittest.TestCase):
|
||||||
nocache=False,
|
nocache=False,
|
||||||
rm=True,
|
rm=True,
|
||||||
buildargs=None,
|
buildargs=None,
|
||||||
|
cache_from=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_ensure_image_exists_no_build(self):
|
def test_ensure_image_exists_no_build(self):
|
||||||
|
|
@ -482,6 +483,7 @@ class ServiceTest(unittest.TestCase):
|
||||||
nocache=False,
|
nocache=False,
|
||||||
rm=True,
|
rm=True,
|
||||||
buildargs=None,
|
buildargs=None,
|
||||||
|
cache_from=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_build_does_not_pull(self):
|
def test_build_does_not_pull(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue