Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.0 kB
2
Indexable
Never
import os

def create_multi_platform_manifest(repo_name, image_tag_arm, image_tag_amd, module_tag):
    ecr_url = f"{os.environ['ECR_URL']}/{repo_name}:{module_tag}"
    ecr_url_arm = f"{os.environ['ECR_URL']}/{repo_name}:{image_tag_arm}"
    ecr_url_amd = f"{os.environ['ECR_URL']}/{repo_name}:{image_tag_amd}"

    def manifest_script():
        return f"""#!/bin/bash
            set -e
            echo "creating manifest for {ecr_url}"
            docker manifest create {ecr_url} {ecr_url_arm} {ecr_url_amd}
            docker manifest annotate {ecr_url} {ecr_url_arm} --os linux --arch arm64
            docker manifest annotate {ecr_url} {ecr_url_amd} --os linux --arch amd64
            docker manifest push {ecr_url}
            docker manifest rm {ecr_url}
        """

    # Assuming there's some execution mechanism like subprocess or Docker API being used
    output = execute_shell_script(manifest_script())  # Replace 'execute_shell_script' with actual execution function
    return output
Leave a Comment