0

Background: We're developing several Node.js microservices on our local Mac OS X machines. Our development environment is a Vagrant/Docker environment in which the code is mapped into to run.

For a specific microservice, we are utilizing two different dependencies: ghooks (devDependency) and argon2-ffi (dependency).

  • ghooks uses node-gyp to creating bindings on the local machine (Mac OS X).
  • argon2-ffi uses node-gyp to creating bindings within the Docker container (Ubuntu).

We now have an issue depending on where npm install or npm rebuild is run. Run one on the local dev machine and the bindings for argon2 prevent the service from running in the Docker container. Run one in the docker container, and the bindings are incorrect for the dev machine, so all Git commands fail.

To compound the problem, a ghook we have configured looks for changes to the package.json file on merges and automatically runs npm install. (This is the behavior on all dozen or so microservices we have and would like to try and retain this behavior.)


We've tried a few things, such as adding more hooks that SSH into the Docker container and rebuild on merges, but this causes issues if the Vagrant machine is not up or in an error state. We've tried checking into Git the Linux binaries node-gyp creates for argon2, but we have automated tests that run outside of the Docker container on both our local dev environments and during the build process out to AWS which fail since they aren't run inside the container.


Is there way to manage how specific dependencies are built with node-gyp? Another strategy we haven't thought of?

Michael Irigoyen
  • 22,513
  • 17
  • 89
  • 131

0 Answers0