-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .npmrc files to node templates #179
base: master
Are you sure you want to change the base?
Conversation
This change adds an empty .npmrc file to the node templates as well as adding the NPM_TOKEN build arg to allow users to specify a private npm registry, or pass credentials to the templates during build process. Use of the NPM_TOKEN build arg means that the credentials are not stored with the images and remain secure once the function is built and deployed. Signed-off-by: Burton Rheutan <[email protected]>
|
Sorry about that, forgot to update the testing section before submitting. I've edited it and included the steps I took. |
Did your package work as expected? What was the command you used with Does |
Updated the testing section to show the faas-cli build command used: The output of
|
How would users pass the build arg? |
I think that's generally up to the user. It's possible to include it in the |
Description
This change adds an empty .npmrc file to the node templates
as well as adding the NPM_TOKEN build arg to allow users
to specify a private npm registry, or pass credentials to the
templates during build process.
Use of the NPM_TOKEN build arg means that the credentials are
not stored with the images and remain secure once the function
is built and deployed.
Using the
--build-arg
means that the.npmrc
file does not need to be removed during the build process, however, if there is concern with keeping the file, it would be trivial to add aRUN rm .npmrc
line to the Dockerfiles.Signed-off-by: Burton Rheutan [email protected]
Motivation and Context
Several users have voiced a need to be able to install private npm packages in order to use the node templates. It was brought up in a few issues, in person, and in Slack.
Which issue(s) this PR fixes
Fixes #103
Also, makes permanent the workaround described in the faas issue openfaas/faas#1025
How Has This Been Tested?
Tested this by creating a verdaccio registry, and creating a private package there. Then, created a new function that referenced that package and including the verdaccio registry in the
.npmrc
file. Invoked the function, and verified the output included the private package's output..npmrc file:
packages.json file:
Then, using faas-cli, ran the build with the
NPM_TOKEN
as a build-arg:Also, verified that not including the
NPM_TOKEN
had no effect on the build (only of course if the.npmrc
file didn't require it)Types of changes
Impact to existing users
None, as new templates will include an empty
.npmrc
file that need not have any content.Checklist:
git commit -s