def build_image(image_path, image_name, build_args=None, dockerfile_path=None):
cmd = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', image_name, image_path]<EOL>if dockerfile_path:<EOL><INDENT>cmd.extend(['<STR_LIT>', dockerfile_path])<EOL><DEDENT>for k, v in (build_args or {}).items():<EOL><INDENT>cmd += ['<STR_LIT>', '<STR_LIT>'.format(k, v)]<EOL><DEDENT>check_call(cmd)<EOL>
Build an image

    Args:
    image_path (str): the path to the image directory
    image_name (str): image 'name:tag' to build
    build_args (dict, optional): dict of docker build arguments
    dockerfile_path (str, optional):
        path to dockerfile relative to image_path
        if not `image_path/Dockerfile`.