Sign inSign up

joscha/node-onbuild-npmrc

By joscha

Updated almost 11 years ago

node image that copies the source (incl. any npm-shrinkwrap.json & .npmrc) before installing

Image
0

397

joscha/node-onbuild-npmrc repository overview

FROM node:latest

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY . /usr/src/app
ONBUILD RUN npm install

CMD [ "npm", "start" ]

This allows you to do some magic in the preinstall and postinstall steps of the npm lifecycle. Especially when your postinstall script depends on resources within the project.

Example:

{
    "build": "rimraf dist && webpack --config ./webpack.config.production.js",
    "postinstall": "npm run build -- --colors"
}

would fail on a "normal" node:onbuild image, because:

  • npm install is run with root privileges and fails if there is no .npmrc file that allows writing to the current dir via unsafe-perm = true
  • ./webpack.config.production.js is not available during the postinstall run.

Tag summary

Content type

Image

Digest

Size

241 MB

Last updated

almost 11 years ago

docker pull joscha/node-onbuild-npmrc