From a11405015f224d34978898baf05758bf7c42c68c Mon Sep 17 00:00:00 2001 From: Christos Hadjiaslanis Date: Mon, 17 Jun 2024 17:24:04 +0200 Subject: [PATCH] Docker compose works for MacOS (#2143) * Docker compose works for MacOS * Added compose.sh to paths which will trigger the docker CI workflow --- .github/workflows/docker.yml | 1 + docker/compose.sh | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7fbe7f4c2b2..c1b27ab3d82 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,6 +8,7 @@ on: - "**" paths: - 'docker/Dockerfile' + - 'docker/compose.sh' - 'Cargo.toml' - '.github/workflows/docker.yml' workflow_dispatch: diff --git a/docker/compose.sh b/docker/compose.sh index e0d9371807e..bcdcf885c0b 100755 --- a/docker/compose.sh +++ b/docker/compose.sh @@ -28,7 +28,21 @@ cleanup() { trap cleanup EXIT INT cd "$ROOT_DIR" -docker build -f docker/Dockerfile . -t linera-test + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + docker build -f docker/Dockerfile . -t linera-test +elif [[ "$OSTYPE" == "darwin"* ]]; then + CPU_ARCH=$(sysctl -n machdep.cpu.brand_string) + if [[ "$CPU_ARCH" == *"Apple"* ]]; then + docker build --build-arg target=aarch64-unknown-linux-gnu -f docker/Dockerfile -t linera-test . + else + echo "Unsupported Architecture: $CPU_ARCH" + exit 1; + fi +else + echo "Unsupported OS: $OSTYPE" + exit 1; +fi cd "$SCRIPT_DIR"