def METHOD_NAME(self, recipe_path):
    """Build container image by calling out to 'sudo apptainer build'."""
    cont_path = container_path()
    def_file = os.path.basename(recipe_path)
    # use --imagename if specified, otherwise derive based on filename of recipe
    img_name = self.img_name
    if img_name is None:
        # definition file Apptainer.<app>-<version, container name <app>-<version>.<img|simg>
        img_name = def_file.split('.', 1)[1]
    cmd_opts = ''
    image_format = self.image_format
    # singularity image format (default for Apptainer)
    if image_format in [None, CONT_IMAGE_FORMAT_SQUASHFS, CONT_IMAGE_FORMAT_SIF]:
        img_path = os.path.join(cont_path, img_name + '.sif')
    # ext3 image format, creating as writable container
    elif image_format == CONT_IMAGE_FORMAT_EXT3:
        raise EasyBuildError("ext3 image format is not supported with Apptainer")
    # sandbox image format, creates as a directory but acts like a container
    elif image_format == CONT_IMAGE_FORMAT_SANDBOX:
        img_path = os.path.join(cont_path, img_name)
        cmd_opts = '--sandbox'
    else:
        raise EasyBuildError("Unknown container image format specified for Apptainer: %s" % image_format)
    if os.path.exists(img_path):
        if build_option('force'):
            print_msg("WARNING: overwriting existing container image at %s due to --force" % img_path)
            remove_file(img_path)
        else:
            raise EasyBuildError("Container image already exists at %s, not overwriting it without --force",
                                 img_path)
    # resolve full path to 'apptainer' binary, since it may not be available via $PATH under sudo...
    apptainer = which('apptainer')
    cmd_env = ''
    apptainer_tmpdir = self.tmpdir
    if apptainer_tmpdir:
        cmd_env += 'APPTAINER_TMPDIR=%s' % apptainer_tmpdir
    cmd = ' '.join(['sudo', cmd_env, apptainer, 'build', cmd_opts, img_path, recipe_path])
    print_msg("Running '%s', you may need to enter your 'sudo' password..." % cmd)
    run_cmd(cmd, stream_output=True)
    print_msg("Apptainer image created at %s" % img_path, log=self.log)