def build_manifest()

in tools/build-image.py [0:0]


def build_manifest(manifest, version):
    print("Building manifest")
    print(" - manifest: %s" % manifest)
    print(" - version:  %s" % version)
    multi_image = create_image_name(manifest, version, "")
    cmd = get_cmd("docker")
    command = [cmd, "manifest", "create", multi_image]
    for arch in architecture:
        image_name = create_image_name(manifest, version, architecture[arch])
        print(" - image:    %s" % image_name)
        # image_manifest = create_image_name(manifest, version, manifestmap[arch])
        # print(" - image manifest:    %s" % image_manifest)
        # temporary push to create tag to allow manifest build
        # https://github.com/docker/cli/issues/3350
        push_image(cmd, image_name)
        command.extend(["--amend", image_name])
    retcode = subprocess.call(command, stdout=subprocess.DEVNULL)
    if retcode:
        fail("docker manifest creation failed")
    # push the manifest
    # purge option is needed: https://github.com/docker/cli/issues/954
    command = [cmd, "manifest", "push", "--purge", multi_image]
    retcode = subprocess.call(command, stdout=subprocess.DEVNULL)
    if retcode:
        fail("docker manifest push failed")
    # remove temporary tags that allowed manifest build
    for arch in architecture:
        image_name = create_image_name(manifest, version, architecture[arch])
        remove_tag(image_name)