def METHOD_NAME(self, pyenv):
    logging.info(f"[{pyenv}] Building Docker image")
    dockerfile = f"{pyenv}.Dockerfile"
    try:
        image, log_stream = client.images.build(path=str(DOCKERFILES_DIR), tag=f"dxpy-testenv:{pyenv}", dockerfile=dockerfile, pull=self.pull, rm=True)
        with open(self.logs_dir / f"{pyenv}_build.log", 'w') as fh:
            for msg in log_stream:
                if "stream" in msg:
                    fh.write(msg["stream"])
    except:
        logging.info(f"[{pyenv}] Docker build command failed and no logs were produced. For manual debugging, run 'docker build -f {DOCKERFILES_DIR}/{dockerfile} {DOCKERFILES_DIR}'")
        raise
    logging.info(f"[{pyenv}] Docker image successfully built")
    return image