WrenSecurity/wrenidm

Failed to build Docker image on ARM architecture

Closed this issue · 5 comments

Building of Docker image on ARM architecture (MacBook PRO with M1 chip in this case) fail with the following error:

#14 83.17 [INFO] --- frontend-maven-plugin:1.12.0:npm (npm-install) @ openidm-ui-admin ---
#14 83.17 [INFO] Running 'npm install' in /project/openidm-ui/openidm-ui-admin
#14 91.36 [INFO]
#14 91.36 [INFO] > puppeteer@4.0.1 install /project/openidm-ui/openidm-ui-admin/node_modules/puppeteer
#14 91.36 [INFO] > node install.js
#14 91.36 [INFO]
#14 91.46 [INFO] The chromium binary is not available for arm64:
#14 91.46 [INFO] If you are on Ubuntu, you can install with:
#14 91.46 [INFO]
#14 91.46 [INFO]  apt-get install chromium-browser
#14 91.46 [INFO]
#14 91.46 [INFO] /project/openidm-ui/openidm-ui-admin/node_modules/puppeteer/lib/BrowserFetcher.js:112
#14 91.46 [INFO]             throw new Error();
#14 91.46 [INFO]             ^
#14 91.46 [INFO]
#14 91.46 [INFO] Error
#14 91.46 [INFO]     at /project/openidm-ui/openidm-ui-admin/node_modules/puppeteer/lib/BrowserFetcher.js:112:19
#14 91.46 [INFO]     at FSReqCallback.oncomplete (fs.js:192:21)
#14 91.63 [INFO] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
#14 91.63 [INFO] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#14 91.63 [INFO]
#14 91.68 [INFO] npm ERR! code ELIFECYCLE
#14 91.68 [INFO] npm ERR! errno 1
#14 91.68 [INFO] npm ERR! puppeteer@4.0.1 install: `node install.js`
#14 91.68 [INFO] npm ERR! Exit status 1
#14 91.68 [INFO] npm ERR!
#14 91.68 [INFO] npm ERR! Failed at the puppeteer@4.0.1 install script.
#14 91.68 [INFO] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#14 91.71 [INFO]
#14 91.71 [INFO] npm ERR! A complete log of this run can be found in:
#14 91.71 [INFO] npm ERR!     /root/.npm/_logs/2022-11-09T12_28_18_901Z-debug.log

Fix in #138.

Issue is still not fixed because Maven's Alpine-based Docker image is not available for arm64.

The issue cannot be easily fixed in this moment. We need Chrome / Chromium for FE tests executed through Puppeteer. Puppeteer itself is not able to install arm64 based Chromium (see puppeteer/puppeteer#7740). So i tried to install Chrome / Chromium in project-build Docker stage manually but there are some issues :

  • Ubuntu-based (version 22.04) Docker Image (3.8.7-eclipse-temurin-17)
    • Chromium –⁠ version installed from the official Ubuntu repository cannot be executed because it requires snap (Error: Command '/usr/bin/chromium-browser' requires the chromium snap to be installed), but snap is not working in Docker environment
    • Chrome –⁠ Chrome for Ubuntu 22.04 and arm64 architecture is not available (the latest supported version was published for Ubuntu 18.04)
  • Alpine-based Docker Image (3.8.7-eclipse-temurin-17-alpine)

There are some third-party repositories with prebuilt Chrome browser for Ubuntu 22.04 and arm64 architecture but there is no guarantee of stability.

As this is only issue for the build stage I think we can go for Debian's Slim image and use OpenJDK package instead of Temurin. I hope there shouldn't be a problem with Chromium / Snap as well.

Fixed in #146. We are using Debian's Slim image with manually installed OpenJDK, Maven and Chromium. Docker Image is buildable on Apple's M1 chip.