'Apache Jena Dockerfile does not run on M1 Mac

I am trying to build a Fuseki container from the documentation found here. I downloaded version 4.4.0 from this repo. When running the build command (docker-compose build --build-arg JENA_VERSION=3.16.0) on Windows everything works fine. When using a mac with M1 chip, I get an error because of the platform that could supposedly be solved by adding --platform=linux/amd64 to the FROM commands in the dockerfile responsible for getting the images for alpine and openjdk. However, when I do so I get another error in the following command:

Step 22/42 : RUN   JDEPS="$(jdeps --multi-release base --print-module-deps --ignore-missing-deps ${FUSEKI_JAR})"  &&   jlink         --compress 2 --strip-debug --no-header-files --no-man-pages         --output "${JAVA_MINIMAL}"         --add-modules "${JDEPS},${JDEPS_EXTRA}" 

which is

Error: java.io.IOException: Cannot run program "objcopy": error=0, Failed to exec spawn helper: pid: 64, exit value: 1
1 error occurred:
    * Status: The command '/bin/sh -c JDEPS="$(jdeps --multi-release base --print-module-deps --ignore-missing-deps ${FUSEKI_JAR})"  &&   jlink         --compress 2 --strip-debug --no-header-files --no-man-pages         --output "${JAVA_MINIMAL}"         --add-modules "${JDEPS},${JDEPS_EXTRA}"' returned a non-zero code: 1, Code: 1

If I add the following command platform: linux/amd64 also to the docker compose file, this step runs infinitely. Can anyone help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source