Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion flytekit/image_spec/image_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import hashlib
import os
import pathlib
import platform
import re
import sys
import typing
Expand Down Expand Up @@ -94,7 +95,7 @@ class ImageSpec:
cuda: Optional[str] = None
cudnn: Optional[str] = None
base_image: Optional[Union[str, "ImageSpec"]] = None
platform: str = "linux/amd64"
Comment thread
pingsutw marked this conversation as resolved.
platform: str = None
pip_index: Optional[str] = None
pip_extra_index_url: Optional[List[str]] = None
pip_secret_mounts: Optional[List[Tuple[str, str]]] = None
Expand Down Expand Up @@ -126,6 +127,17 @@ def __post_init__(self):
f"- 'docker.io/username' (for docker hub)\n"
)

if self.platform is None:
if (
self.registry
and self.registry.lower().startswith("localhost:")
Comment thread
machichima marked this conversation as resolved.
and platform.machine().lower() in ("arm64", "aarch64")
):
# Only change platform to ARM64 if platform is not set and pushing to local registry on ARM64 machine
self.platform = "linux/arm64"
else:
self.platform = "linux/amd64"

# If not set, help the user set this option as well, to support the older default behavior where existence
# of the source root implied that copying of files was needed.
if self.source_root is not None:
Expand Down
Loading