commit
7d6c63d1b7
10 changed files with 51 additions and 7 deletions
|
|
@ -181,12 +181,15 @@ class TopLevelCommand(DocoptCommand):
|
|||
Usage: build [options] [SERVICE...]
|
||||
|
||||
Options:
|
||||
--force-rm Always remove intermediate containers.
|
||||
--no-cache Do not use cache when building the image.
|
||||
--pull Always attempt to pull a newer version of the image.
|
||||
"""
|
||||
no_cache = bool(options.get('--no-cache', False))
|
||||
pull = bool(options.get('--pull', False))
|
||||
project.build(service_names=options['SERVICE'], no_cache=no_cache, pull=pull)
|
||||
project.build(
|
||||
service_names=options['SERVICE'],
|
||||
no_cache=bool(options.get('--no-cache', False)),
|
||||
pull=bool(options.get('--pull', False)),
|
||||
force_rm=bool(options.get('--force-rm', False)))
|
||||
|
||||
def help(self, project, options):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -278,10 +278,10 @@ class Project(object):
|
|||
for service in self.get_services(service_names):
|
||||
service.restart(**options)
|
||||
|
||||
def build(self, service_names=None, no_cache=False, pull=False):
|
||||
def build(self, service_names=None, no_cache=False, pull=False, force_rm=False):
|
||||
for service in self.get_services(service_names):
|
||||
if service.can_be_built():
|
||||
service.build(no_cache, pull)
|
||||
service.build(no_cache, pull, force_rm)
|
||||
else:
|
||||
log.info('%s uses an image, skipping' % service.name)
|
||||
|
||||
|
|
|
|||
|
|
@ -701,7 +701,7 @@ class Service(object):
|
|||
cgroup_parent=cgroup_parent
|
||||
)
|
||||
|
||||
def build(self, no_cache=False, pull=False):
|
||||
def build(self, no_cache=False, pull=False, force_rm=False):
|
||||
log.info('Building %s' % self.name)
|
||||
|
||||
path = self.options['build']
|
||||
|
|
@ -715,6 +715,7 @@ class Service(object):
|
|||
tag=self.image_name,
|
||||
stream=True,
|
||||
rm=True,
|
||||
forcerm=force_rm,
|
||||
pull=pull,
|
||||
nocache=no_cache,
|
||||
dockerfile=self.options.get('dockerfile', None),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue