code: def build_image_from_git(self, url, image, git_path=None, git_commit=None,
                               copy_dockerfile_to=None,
                               stream=False, use_cache=False):
          
          logger.info("building image '%s' from git repo '%s' specified as URL '%s'",
                      image, git_path, url)
          logger.info("will copy Dockerfile to '%s'", copy_dockerfile_to)
          temp_dir = tempfile.mkdtemp()
          response = None
          try:
              clone_git_repo(url, temp_dir, git_commit)
              build_file_path, build_file_dir = figure_out_build_file(temp_dir, git_path)
              if copy_dockerfile_to:  # TODO: pre build plugin
                  shutil.copyfile(build_file_path, copy_dockerfile_to)
              response = self.build_image_from_path(build_file_dir, image, use_cache=use_cache)
          finally:
              try:
                  shutil.rmtree(temp_dir)
              except (IOError, OSError) as ex:
                  # no idea why this is happening
                  logger.warning("Failed to remove dir '%s': %r", temp_dir, ex)
          logger.info("build finished")
          return response
docs: build image from provided url and tag it
  
          this operation is asynchronous and you should consume returned generator in order to wait
          for build to finish
  
          :param url: str
          :param image: ImageName, name of the resulting image
          :param git_path: str, path to dockerfile within gitrepo
          :param copy_dockerfile_to: str, copy dockerfile to provided path
          :param stream: bool, True returns generator, False returns str
          :param use_cache: bool, True if you want to use cache
          :return: generator