openscad / docker-openscad

OpenSCAD-related docker files
BSD 2-Clause "Simplified" License
11 stars 10 forks source link

Release images for Apple M1 / ARM #8

Closed spuder closed 2 years ago

spuder commented 2 years ago

If you attempt to run these docker containers on an Apple M1 Processor, you get the following error

docker run openscad/openscad:2021.01 openscad version
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error

Solutions

  1. Use buildx as shown in this blog

Pros: Just works Cons: Requires docker desktop which is now a paid product if running on a work computer

  1. Offload building ci images from developer workstation to github actions. Here is an example
t-paul commented 2 years ago

Looks like docker buildx is still supported on CE. Latest release and dev snapshot are now available for both arm64 and amd64 platforms. Tested on Raspberry PI 400.

Older releases may or may not follow, if it just works, they'll appear in the near future.

If this works specifically for Apple M1, I can't test, so I'm going to close this as solved. There's not going to be dedicated M1 support for docker images at this point.

t-paul commented 2 years ago

FWIW, all images are now available for both architectures: https://hub.docker.com/r/openscad/openscad/tags

spuder commented 2 years ago

Thank you. Tested and is working on M1 Mac

uname -a
Darwin <REDACTED_HOSTNAME> 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:05 PST 2021; root:xnu-7195.141.14~1/RELEASE_ARM64_T8101 arm64

docker run --init openscad/openscad:2021.01 xvfb-run -a openscad --version
OpenSCAD version 2021.01
t-paul commented 2 years ago

Thanks, that's very good news.

spuder commented 2 years ago

For future reference here was the solution. ( I find myself referring back to this issue frequently)

https://github.com/openscad/docker-openscad/commit/77233956de3030b0a1e351056f14aae84b6af1e4

    docker buildx build \
        --push \
        --platform linux/amd64,linux/arm64 \
        --build-arg=REFS="$REF" \
        --build-arg=BRANCH="$BRANCH" \
        --build-arg OPENSCAD_VERSION="$VERSION" \
        --build-arg BUILD_TYPE="Release" \
        --build-arg DEBUG="-" \
        --build-arg JOBS=4 \
        $DOCKERTAG1_ARGS \
        $DOCKERTAG2_ARGS \
        $DOCKERFILE_ARGS \
        "$DIR"