rse / node-prince

Node API for executing PrinceXML via prince(1) CLI
https://npmjs.com/prince
49 stars 24 forks source link

Platform detection does not work for node:18.13.0-alpine base image on aarch64 architecture #58

Closed ercgrat closed 4 months ago

ercgrat commented 4 months ago

The prince-npm.js file does not include handling for alpine on aarch64 architecture. Here's a patch we've needed to add to get prince to execute successfully in our containers. Alpine does not use glibc.

diff --git a/prince-npm.js b/prince-npm.js
index c191313fbf582f327ab4bf30380839fd244cada8..9c7a20fe7157a9af47e15674a2933b130f6f017c 100644
--- a/prince-npm.js
+++ b/prince-npm.js
@@ -141,6 +141,9 @@ var princeDownloadURL = function () {
                         resolve("https://www.princexml.com/download/prince-15.2-debian12-arm64.tar.gz");
                     else if (platform.match(/^arm64-debian11(?:\.\d+)*$/))
                         resolve("https://www.princexml.com/download/prince-15.2-debian11-arm64.tar.gz");
+                    else if (platform.match(/^aarch64-alpine[23](?:\.\d+)*$/))
+                        // Alpine linux ships with musl and not glibc, so we need a binary linked against musl.
+                        resolve("https://www.princexml.com/download/prince-15.2-linux-generic-aarch64-musl.tar.gz");
                     else
                         resolve("https://www.princexml.com/download/prince-15.2-linux-generic-aarch64.tar.gz");
                 }
rse commented 4 months ago

Applied. Thanks.