From 99368520ca91e6b03bb6701f1f4d330b8dd3ef97 Mon Sep 17 00:00:00 2001 From: Heiru Wu Date: Thu, 28 Mar 2024 04:54:08 +0800 Subject: [PATCH] fix(ray): support target platform for image building --- instill/helpers/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/instill/helpers/build.py b/instill/helpers/build.py index b649576..7a81954 100644 --- a/instill/helpers/build.py +++ b/instill/helpers/build.py @@ -1,6 +1,7 @@ import argparse import hashlib import os +import platform import shutil import tempfile @@ -14,7 +15,10 @@ if __name__ == "__main__": Logger.i("[Instill Builder] Setup docker...") - + if platform.machine() in ("i386", "AMD64", "x86_64"): + default_platform = "amd64" + else: + default_platform = platform.machine() parser = argparse.ArgumentParser() parser.add_argument( "--no-cache", @@ -22,6 +26,13 @@ action="store_true", required=False, ) + parser.add_argument( + "--target-arch", + help="target platform architecture for the model image, default to host", + default=default_platform, + choices=["arm64", "amd64"], + required=False, + ) client = docker.from_env() try: @@ -66,6 +77,7 @@ rm=True, pull=True, nocache=args.no_cache, + platform=f"linux/{args.target_arch}", tag=f"{repo}:{tag}", buildargs={ "RAY_VERSION": ray_version,