We ahead's base image for developing Node.js applications.
2.6K
Base image for developing Node.js applications.
Check out the branches for each version of Node.js supported by this repository.
This container includes:
See example
Create a Dockerfile with FROM weahead/nodejs:<tag>. Where tag is any
tag listed at https://hub.docker.com/r/weahead/nodejs/tags/.
Create a folder named app next to Dockerfile.
Optionally, declare environment variables in docker-compose.yml files. NODE_ENV is properly set by default.
Add a package.json file to app folder and declare your dependencies.
This gives you a folder structure like this:
.
├── Dockerfile
├── app
│ └── package.json
└── ...
Build it with docker build -t <name>:<tag> .
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.
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.
Content type
Image
Digest
Size
31.6 MB
Last updated
about 8 years ago
docker pull weahead/nodejs:10.10.0