@staticmethod
def build_image(client, **kwargs):
    """
		Builds a container image, printing progress output as it is received
		"""
    events = client.api.build(decode=True, **kwargs)
    imageID = None
    for event in events:
        output = event.get('stream', event.get('status', '')).strip()
        details = event.get('progress', '').strip()
        if output != '':
            print('{}{}'.format(output, ' ' + details if details != '' else
                ''), flush=True)
        elif output == '' and len(event.get('stream', '')) > 0:
            pass
        elif 'error' in event:
            raise RuntimeError('Docker build failed with error: {}'.format(
                event['error']))
        elif 'aux' in event and 'ID' in event['aux']:
            imageID = event['aux']['ID']
        else:
            print(event, flush=True)
    return imageID
