diff --git a/runon/runon.py b/runon/runon.py index 05120b0..89ade43 100755 --- a/runon/runon.py +++ b/runon/runon.py @@ -115,24 +115,15 @@ def build_image(client, conf, update, verbose): dockerfile.append(pkginstall.format(p)) try: if verbose: - # fallback to external command 'docker build' as there is - # no way to follow the build progress with API. print('Building image {} ...'.format(tag)) - cmd = ['docker', 'build'] - if update: - cmd.append('--no-cache') - cmd += ['-t', tag, '-'] - ret = subprocess.run(cmd, - input='\n'.join(dockerfile).encode('utf-8'), - stderr=subprocess.STDOUT, check=True) - image = client.images.get(tag) - else: - with io.BytesIO('\n'.join(dockerfile).encode('utf-8')) as fd: - image, logs = client.images.build(tag=tag, fileobj=fd, rm=True, nocache=update) - if verbose: - print('Built image {} / {}'.format(image.tags[0], image.short_id)) - for l in logs: - print(l.get('stream', '').strip('\n')) + cmd = ['docker', 'build'] + if update: + cmd.append('--no-cache') + cmd += ['-t', tag, '-'] + ret = subprocess.run(cmd, + input='\n'.join(dockerfile).encode('utf-8'), + stderr=subprocess.STDOUT, check=True) + image = client.images.get(tag) if not os.path.exists(cache_dir): os.mkdir(cache_dir)