Skip to content

Commit

Permalink
Merge pull request #1266 from NickeZ/docker-macos-compat
Browse files Browse the repository at this point in the history
Some changes to docker to make it work on apple m1 / macos
  • Loading branch information
NickeZ authored Aug 7, 2024
2 parents 11fac8a + b0ca0f4 commit 0337053
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jlink-flash-factory-setup: | build
jlink-flash-firmware-semihosting: | build-semihosting
JLinkExe -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build-semihosting/scripts/firmware.jlink
dockerinit:
./scripts/container.sh build --pull --force-rm --no-cache -t shiftcrypto/firmware_v2 .
./scripts/container.sh build --pull --platform linux/amd64 --force-rm --no-cache -t shiftcrypto/firmware_v2 .
dockerdev:
./scripts/dockerenv.sh
dockerrel:
Expand Down
9 changes: 6 additions & 3 deletions scripts/dockerenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dockerdev () {

if ! $RUNTIME images --filter "reference=${CONTAINER_IMAGE}" | grep -q "${CONTAINER_IMAGE}"; then
echo "No '${CONTAINER_IMAGE}' ${RUNTIME} image found! Maybe you need to run
'${RUNTIME} build --pull -t ${CONTAINER_IMAGE} .'?" >&2
'${RUNTIME} build --platform linux/amd64 --pull -t ${CONTAINER_IMAGE} .'?" >&2
exit 1
fi

Expand Down Expand Up @@ -74,8 +74,11 @@ dockerdev () {
# Use same user/group id as on the host, so that files are not created as root in the
# mounted volume. Only needed for Docker. On rootless podman, the host user maps to the
# container root user.
$RUNTIME exec -it "$CONTAINER_NAME" groupadd -o -g "$(id -g)" dockergroup
$RUNTIME exec -it "$CONTAINER_NAME" useradd -u "$(id -u)" -m -g dockergroup dockeruser
# If group already exists, don't create it
if ! $RUNTIME exec -it "$CONTAINER_NAME" getent group "$(id -g)" > /dev/null ; then
$RUNTIME exec -it "$CONTAINER_NAME" groupadd -o -g "$(id -g)" dockergroup
fi
$RUNTIME exec -it "$CONTAINER_NAME" useradd -u "$(id -u)" -m -g "$(id -g)" dockeruser
fi

# Call a second time to enter the container.
Expand Down

0 comments on commit 0337053

Please sign in to comment.