A serverless Docker microservice that makes use of build env to access private npm repositories
Switch branches/tags
Nothing to show
Clone or download
Latest commit 8a1d38d Jul 21, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dockerignore initial commit Jul 19, 2018
.gitignore initial commit Jul 19, 2018
Dockerfile initial commit Jul 19, 2018
index.js initial commit Jul 19, 2018
now.json Fix now.json Jul 22, 2018
package.json initial commit Jul 19, 2018
readme.md Update readme.md Jul 19, 2018
yarn.lock initial commit Jul 19, 2018

readme.md

now-build-env-starter-dynamic

An example of a dynamic deployment built using private npm modules.

Example URL: https://now-build-env-starter-dynamic-rismihvmtj.zeit.sh/

How to use

Create a readonly npm token:

npm token create --read-only

Create a secret with its value (in this example we call it npm-token):

# replace "MY_TOKEN_VALUE" with the value returned
# by the `npm token` command
now secret add npm-token MY_TOKEN_VALUE

Add a private repo (if you have any):

yarn add @my-team/private-repo

Then you are ready to deploy!

now

Note: this deployment is set to have its source code be public. If you intend for it to be private, set public: false in now.json.

How it Works

In now.json we defined a build env var:

  • NPM_TOKEN

And a runtime env:

  • TEXT

NPM_TOKEN is used to authenticate with the npm registry to be able to download private repositories.

TEXT is used to respond to all incoming HTTP requests.

Finally, .dockerignore is used in order to only upload files into the build stage that are necessary for this project to work.