Just learned about Docker and love the concept of “if it worked here, it will work there”.
How do I pass password to build so npm / github can pull in private packages?
Here is an example:
Build 1
C:\Users\john_\Documents\GitHub\purple_cloud>docker build .
Sending build context to Docker daemon 36.24MB
Step 1/7 : FROM node:9.4
—> c888d933885c
Step 2/7 : WORKDIR /app
—> Using cache
—> 5a3b6b9d50ea
Step 3/7 : COPY package.json /app
—> Using cache
—> 41c0a0f495de
Step 4/7 : COPY . /app
—> d8a8532f8828
Step 5/7 : RUN npm install
—> Running in 39cb7afdaa48
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://github.com/johngrabner/moch_time.git
npm ERR!
npm ERR! remote: Invalid username or password.
npm ERR! fatal: Authentication failed for 'https://github.com/johngrabner/moch_time.git/'
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-01-19T16_11_17_836Z-debug.log
The command ‘/bin/sh -c npm install’ returned a non-zero code: 1
Dockerfile
FROM node:9.4
WORKDIR /app
COPY package.json /app
COPY . /app
RUN npm install
CMD npm start
EXPOSE 80