Skip to content

Sample Docker file showing how a root image can be used for a set of Node based microservices.

Notifications You must be signed in to change notification settings

philcockfield/sample-docker-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Docker Microservices

A base image for a set of node-based Microservices

ONBUILD Command

The base image sets up a common pattern for bundling a Node app within an image, excluding unnecessary NPM cache data, and installing common -global NPM modules.

The ONBUILD command copies the node app into the image consistently, so dervied Dockerfile's for each service can be as short as:

FROM philcockfield/base
EXPOSE 4040

Building

To build the image run from the project root:

cd base
sh ./base.sh

Secret

The image contains one secret, the NPM authorization token required to access private modules. This pattern for accessing NPM's private modules within a Dockerfile was described here:

Ensure that the following environment variable is setup within your profile:

export NPM_TOKEN=<value>

The token must be generated from a user-account on NPM that has access to the private modules being referenced by the packaged node app. To get the NPM token login to NPM at the command line, then open the file at:

~/.npmrc

For more information see Deploying with npm private modules.

About

Sample Docker file showing how a root image can be used for a set of Node based microservices.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages