Skip to content

Commit

Permalink
Support building docker images from non arm architecture. (#304)
Browse files Browse the repository at this point in the history
* Support building docker images from non arm architecture.

* Add PLATFORM variable.
  • Loading branch information
mbobrovskyi authored Jan 2, 2025
1 parent 35c55de commit 5e779cf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xpk/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
CLOUD_PLATFORM_AUTH_SCOPE_URL = (
'"https://www.googleapis.com/auth/cloud-platform"'
)
PLATFORM = 'linux/amd64'


class CapacityType(enum.Enum):
Expand Down Expand Up @@ -1675,7 +1676,8 @@ def build_docker_image_from_base_image(args, verbose=True) -> tuple[int, str]:
)
tmp = write_tmp_file(docker_file)
docker_build_command = (
f'docker build -f {str(tmp.file.name)} -t {docker_name} {args.script_dir}'
f'docker buildx build --platform={PLATFORM} -f {str(tmp.file.name)} -t'
f' {docker_name} {args.script_dir}'
)
xpk_print(f'Building {args.script_dir} into docker image.')
return_code = run_command_with_updates(
Expand Down

0 comments on commit 5e779cf

Please sign in to comment.