phantomjs-prebuilt package compatible with alpine-based docker image.
musl-libc vs glibc
musl-libc as its C library instead of
glibc to shrink down the image size and improve performance .
However phantomjs doesn’t get compiled with
musl-libc which cripples
phantomjs-prebuilt node package inside the container. The cause was pinned down to the missing
It appears there is no fix for this even after so long.
One approach is to Dockerize phantomjs into linux executables inside a
glibc compatible base (Debian or Ubuntu):
Which gives us a
phantomjs.tar.gz with the following structure:
phantomjs.tar.gz into the alpine image we are going to build.
phantomjs-prebuilt should now work fine in alpine-based docker containers.