mirror of https://github.com/docker/compose.git
Add `--no-cache` option to `fig build` (Closes #152)
Signed-off-by: Mark Steve Samson <hello@marksteve.com>
This commit is contained in:
parent
a12f3b40d5
commit
47bbc35b74
|
@ -103,9 +103,13 @@ class TopLevelCommand(Command):
|
|||
e.g. `figtest_db`. If you change a service's `Dockerfile` or the
|
||||
contents of its build directory, you can run `fig build` to rebuild it.
|
||||
|
||||
Usage: build [SERVICE...]
|
||||
Usage: build [options] [SERVICE...]
|
||||
|
||||
Options:
|
||||
--no-cache Do not use cache when building the image.
|
||||
"""
|
||||
self.project.build(service_names=options['SERVICE'])
|
||||
no_cache = bool(options.get('--no-cache', False))
|
||||
self.project.build(service_names=options['SERVICE'], no_cache=no_cache)
|
||||
|
||||
def help(self, options):
|
||||
"""
|
||||
|
|
|
@ -154,10 +154,10 @@ class Project(object):
|
|||
for service in reversed(self.get_services(service_names)):
|
||||
service.kill(**options)
|
||||
|
||||
def build(self, service_names=None, **options):
|
||||
def build(self, service_names=None, no_cache=False):
|
||||
for service in self.get_services(service_names):
|
||||
if service.can_be_built():
|
||||
service.build(**options)
|
||||
service.build(no_cache)
|
||||
else:
|
||||
log.info('%s uses an image, skipping' % service.name)
|
||||
|
||||
|
|
|
@ -356,14 +356,15 @@ class Service(object):
|
|||
|
||||
return container_options
|
||||
|
||||
def build(self):
|
||||
def build(self, no_cache=False):
|
||||
log.info('Building %s...' % self.name)
|
||||
|
||||
build_output = self.client.build(
|
||||
self.options['build'],
|
||||
tag=self._build_tag_name(),
|
||||
stream=True,
|
||||
rm=True
|
||||
rm=True,
|
||||
nocache=no_cache,
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue