Public | Automated Build

Last pushed: 4 months ago
Short Description
We ahead's base image for developing Node.js applications.
Full Description

We ahead's Node.js in a container

Base image for developing Node.js applications.

Layout of this repository

Check out the branches for each version of Node.js supported by this repository.


This container includes:


See example

  1. Create a Dockerfile with FROM weahead/nodejs:<tag>. Where tag is a
    version number like 8.9.3.

  2. Create a folder named app next to Dockerfile.

  3. Optionally, declare environment variables in docker-compose.yml files.
    NODE_ENV is properly set by default.

  4. Add a package.json file to app folder and declare your dependencies.

    This gives you a folder structure like this:

    ├── Dockerfile
    ├── app
    │   └── package.json
    └── ...
  5. Build it with docker build -t <name>:<tag> .

Node.js service - npm scripts

Upon startup of a container built from this base image, S6 will start a Node.js
service that will run a command depending on the value of the environment
variable NODE_ENV:

Value Command
development npm run dev
production npm run start

It is recommended you declare you run configuration in npm scrips section of
the package.json file. Watchers and things for dev and build and/or start
of webserver for start.

S6 supervision

To use additional services S6 supervision can be used. More information on how
to use S6 can be found in their documentation.

The recommended way is to use COPY root / in a descendant Dockerfile with
the directory structure found in example/root.



Docker Pull Command
Source Repository