diff --git a/README.md b/README.md index 8380ea36..edbf8b61 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,17 @@ aswfdocker --verbose build --ci-image-type IMAGE --group vfx1 --version 2026 --t aswfdocker build --ci-image-type aswftesting/ci-openexr:2026 ``` +### Building on macOS + +Native macOS support is our goal, but due to limited resources, active development is intermittent. In the meantime, our existing build workflows only build Linux artifacts on macOS: `aswfdocker` drives Linux containers (for example `linux/amd64` images and Conan packages for Linux), not native macOS toolchains. + +Configure Docker with a minimum of: + +- 8 CPU cores allocated to Docker +- 16 GB of memory allocated to Docker + +Due to conflicts with Rosetta, [buildx](https://docs.docker.com/buildx/working-with-buildx/) should be run on the Docker VMM. + ### Windows Considerations Native Windows support is our goal, but due to limited resources, active development is intermittent. In the meantime, our existing build workflows work under WSL. @@ -272,7 +283,6 @@ Native Windows support is our goal, but due to limited resources, active develop [Here](https://docs.astral.sh/uv/) are the `uv` docs. - ## Use Cases ### GitHub Actions diff --git a/python/aswfdocker/builder.py b/python/aswfdocker/builder.py index 9360e047..6ed5644d 100644 --- a/python/aswfdocker/builder.py +++ b/python/aswfdocker/builder.py @@ -3,10 +3,12 @@ """ CI Image and Package Builder """ + import logging import subprocess import json import os +import sys import tempfile import typing @@ -114,6 +116,9 @@ def make_bake_dict( "id=conan_password,env=CONAN_PASSWORD", ], } + # Docker Desktop on Apple Silicon defaults to linux/arm64; pin amd64 to match CI. + if sys.platform == "darwin": + target_dict["platforms"] = ["linux/amd64"] root["target"][f"{image}-{major_version}"] = target_dict root["group"] = {"default": {"targets": list(root["target"].keys())}} diff --git a/python/aswfdocker/tests/test_builder.py b/python/aswfdocker/tests/test_builder.py index a022a76f..e1a7dc7d 100644 --- a/python/aswfdocker/tests/test_builder.py +++ b/python/aswfdocker/tests/test_builder.py @@ -8,6 +8,7 @@ import unittest import logging import tempfile +from unittest.mock import patch from click.testing import CliRunner @@ -22,6 +23,43 @@ def setUp(self): repo_uri="notauri", source_branch="testing", aswf_version="2024.123" ) + @patch.object(builder.sys, "platform", "darwin") + def test_bake_dict_sets_linux_amd64_platform_on_macos(self): + """Match CI arch on Docker Desktop (Apple Silicon defaults to linux/arm64).""" + b = builder.Builder( + self.build_info, + groupinfo.GroupInfo( + names=["base"], + versions=["2019"], + type_=constants.ImageType.IMAGE, + targets=[], + ), + ) + baked = b.make_bake_dict(False, False) + self.assertEqual( + baked["target"]["ci-base-2019"]["platforms"], + ["linux/amd64"], + ) + + def test_bake_dict_omits_platforms_when_not_darwin(self): + b = builder.Builder( + self.build_info, + groupinfo.GroupInfo( + names=["base"], + versions=["2019"], + type_=constants.ImageType.IMAGE, + targets=[], + ), + ) + for plat in ("linux", "win32"): + with patch.object(builder.sys, "platform", plat): + baked = b.make_bake_dict(False, False) + self.assertNotIn( + "platforms", + baked["target"]["ci-base-2019"], + msg=f"host sys.platform={plat!r}", + ) + def test_package_opentimelineio_2019_dict(self): b = builder.Builder( self.build_info, @@ -82,6 +120,7 @@ def test_image_base_2019_dict(self): baked["target"]["ci-base-2019"]["args"]["ASWF_VERSION"], base_version ) + @patch.object(builder.sys, "platform", "linux") def test_image_base_2019clang_dict(self): b = builder.Builder( self.build_info, @@ -174,6 +213,7 @@ def test_image_base_2019clang_dict(self): }, ) + @patch.object(builder.sys, "platform", "linux") def test_image_base_2019_2020_dict(self): b = builder.Builder( self.build_info,