Skip to content

Commit

Permalink
Add workaround for Arm based MACs
Browse files Browse the repository at this point in the history
- Auto-detect Arm based MAC and set `DOCKER_DEFAULT_PLATFORM=linux/amd64` to ensure docker uses amd64 emulation and uses the available base images.
- This is required since there are no Arm based base images for the project currently.

Signed-off-by: Wade Barnes <[email protected]>
  • Loading branch information
WadeBarnes committed Jul 19, 2023
1 parent 4dfeeb1 commit 027df22
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions manage
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash
export MSYS_NO_PATHCONV=1

# Set default platform to linux/amd64 when running on Arm based MAC since there are no arm based images available currently.
if [[ $OSTYPE == 'darwin'* ]]; then
architecture=$(uname -m)
if [[ "${architecture}" == 'arm'* ]] || [[ "${architecture}" == 'aarch'* ]]; then
export DOCKER_DEFAULT_PLATFORM=linux/amd64
fi
fi

# getDockerHost; for details refer to https://github.com/bcgov/DITP-DevOps/tree/main/code/snippets#getdockerhost
. /dev/stdin <<<"$(cat <(curl -s --raw https://raw.githubusercontent.com/bcgov/DITP-DevOps/main/code/snippets/getDockerHost))"
export DOCKERHOST=$(getDockerHost)
Expand Down

0 comments on commit 027df22

Please sign in to comment.