Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

NOTICE:

Active maintenance of the image has been halted. Your contributions are welcome.

Table of Contents

Introduction

Dockerfile to build a nodejs+express image with nodemon.

Contributing

If you find this image useful here's how you can help:

  • Send a Pull Request with your awesome new features and bug fixes
  • Help new users with Issues they may encounter
  • Support the development of this image with a donation

Installation

docker run -it --rm -v /usr/local/bin:/target \
sameersbn/nodejs:latest install

This installs wrapper scripts to launch node, nodejs, npm, express and nodemon on the host.

Usage

Note: These commands are executed on the host

express -c less myExpress
cd myExpress
npm install
npm start

You can also use nodemon bin/www instead of npm start.

If the command being executed is present on the host, then the host command is executed and the docker image is not started.

Limitations

The only known limitation is that you cannot install node modules globally, that is to say npm install -g <module-name> will not work. These can only be installed from the Dockerfile. If you want to add node modules globally please send a PR.

How it works

The wrapper scripts mount the current working directory and host networking while starting the sameersbn/nodejs image. The command executed while starting the image is the same as the name of the wrapper script that was launched with whatever arguments were passed while running the wrapper script.

For example, if npm start is executed, the following command is executed by the wrapper script:

docker run -it --rm --net=host \
  -v $PWD:/home/nodejs/src sameersbn/nodejs:latest npm start

Upgrading

To upgrade to newer releases, simply update the image

docker pull sameersbn/nodejs:latest

Uninstallation

docker run -it --rm -v /usr/local/bin:/target \
sameersbn/nodejs:latest uninstall
Docker Pull Command
Owner
sameersbn
Source Repository

Comments (0)