node.bcrypt.js icon indicating copy to clipboard operation
node.bcrypt.js copied to clipboard

Move to prebuild

Open recrsn opened this issue 6 years ago • 5 comments

node-pre-gyp has been causing a lot of installation errors. Move to prebuilt. This should fix most of the installation errors.

This task is high priority

recrsn avatar Oct 22 '18 16:10 recrsn

+1

hroland avatar Feb 27 '20 21:02 hroland

I've created a branch that uses prebuildify. https://github.com/thom-nic/node.bcrypt.js/tree/prebuildify-and-docker-build

It builds locally on darwin-x64 and I can create prebuilds in a Docker container for linux-x64. I have Dockerfile definitions to cross-build for armhf and aarch64. Builds succeed on both of those environments however unit tests fail. I would love to get some eyes on the failing tests.

Basic prebuildify usage:

npm i -g prebuildify node-gyp
npm run build   # calls `prebuildify`

To start with Docker for cross-platform build, do this from my branch:

# Build everything and run unit tests:
docker build -t thom/bcryptjs-linux-x64-builder .   
# Create a container just so we can copy the artifacts from the container to host (for deployment)
docker create --name donut thom/bcryptjs-linux-x64-builder
docker cp donut:/usr/local/opt/bcrypt-js/prebuilds .

Then you'll see (on MacOS, have already built locally):

± ls -lF prebuilds
total 0
drwxr-xr-x  3 thom  staff  96 Sep  2 22:20 darwin-x64/
drwxr-xr-x  3 thom  staff  96 Sep  2 22:20 linux-x64/

To run the armhf build, it is similar but add -f to choose a different docker file:

docker build -t thom/bcryptjs-linux-aarch64-builder -f Dockerfile-aarch64 .

To not run the failing tests then start an interactive session for test/debugging, do:

docker build -t thom/bcryptjs-linux-aarch64-builder -f Dockerfile-aarch64 --build-arg=RUN_TESTS=false .
docker run -it --name donut-aarch64 thom/bcryptjs-linux-aarch64-builder /bin/bash -l

As a baseline I'm going to try running the unit tests on a native armhf device and see if unit tests pass or fail there.

The docker files were inspired by node-sqlite3 and I've adapted it for cross-platform builds with prebuildify in that project. Feedback welcome.

thom-nic avatar Sep 03 '21 03:09 thom-nic

Thanks a lot @thom-nic

recrsn avatar Sep 04 '21 17:09 recrsn

@recrsn would you like me to submit a PR? I made some tweaks so it is as merge-friendly as possible.

thom-nic avatar Sep 10 '21 02:09 thom-nic

@thom-nic Please submit a PR, I can check why the tests are failing

recrsn avatar Sep 13 '21 18:09 recrsn

@recrsn Any idea when v6 will be released?

JasonMan34 avatar Nov 20 '23 10:11 JasonMan34