Skip to content

Commit

Permalink
chore(dev): Linux Docker builder works from Apple Silicon ARM64 MacOS…
Browse files Browse the repository at this point in the history
… cross-compile to Intel x86_64
  • Loading branch information
danielweck committed Dec 3, 2024
1 parent 10bae78 commit 9c6094d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh

#$ arch ====> arm64
#$ uname -m ====> arm64
#$ env /usr/bin/arch -x86_64 /bin/zsh --login
#$ arch ====> i386
#$ uname -m ====> x86_64
#$ flox activate (ideally after clearing .flox caches and manifest lock)

if [[ $(uname -m) == 'arm64' ]]; then
rm -f ./package.json.original
cp ./package.json ./package.json.original
Expand All @@ -16,7 +23,13 @@ docker info
#--build-arg BUST_CACHE=$(date +%s)
#--build-arg BUST_CACHE=`date +%s`
#--build-arg BUST_CACHE=1
docker build --progress=plain --build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S) -f ./Dockerfile -t thorium-docker-image .

if [[ $(uname -m) == 'arm64' ]]; then
docker build --platform linux/arm64 --progress=plain --build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S) -f ./Dockerfile -t thorium-docker-image .
else
docker build --platform linux/amd64 --progress=plain --build-arg BUST_CACHE=$(date +%Y%m%d-%H%M%S) -f ./Dockerfile -t thorium-docker-image .
fi

# --platform linux/x86_64
# --platform=linux/amd64

Expand Down Expand Up @@ -45,7 +58,13 @@ npm run clean
# --volume list
# --detach
# --rm
docker run --name thorium-docker-container thorium-docker-image
#
if [[ $(uname -m) == 'arm64' ]]; then
docker run --platform linux/arm64 --name thorium-docker-container thorium-docker-image
else
docker run --platform linux/amd64 --name thorium-docker-container thorium-docker-image
fi


# read -p "WAIT FOR DONE_PRESS_ENTER_KEY_NOW ..."

Expand Down

0 comments on commit 9c6094d

Please sign in to comment.