Search code examples
node.jsibm-cloudcontinuous-delivery

IBM Cloud DevOps pipeline deploy with NodeJS and private registry


Using private registry in connection with IBM Cloud DevOps pipeline, we've got modules published. In DevOps pipeline also build is possible using following tactic:

    #!/bin/bash
    export PATH=/opt/IBM/node-v6.7.0/bin:$PATH
    npm config set @<scope>:registry <registry-url>
    echo "//<registry-url-short>:_authToken=$NPM_TOKEN" >> ~/.npmrc
    npm install

This way both public and private modules are found and installed. However, when it comes time to deploy to NodeJS runtime, then 'npm install' is done on platform side.

How can we instruct that with above ?


Solution

  • Another approach is to package your .npmrc file along with your app when you push it. More info here https://github.com/cloudfoundry/nodejs-buildpack/issues/79

    The approach here is to create a .npmrc as part of your build stage and add it to the root of your artifact folder. In the next stage when you deploy the app from the artifact folder your npm configuration will be correctly set for per-project config (see https://docs.npmjs.com/files/npmrc) and the npm install that the cf node build-pack performs will work correctly.