Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sameersbn/docker-nodejs
Dockerfile to build a nodejs+express image with nodemon
https://github.com/sameersbn/docker-nodejs
Last synced: about 1 month ago
JSON representation
Dockerfile to build a nodejs+express image with nodemon
- Host: GitHub
- URL: https://github.com/sameersbn/docker-nodejs
- Owner: sameersbn
- License: mit
- Created: 2014-07-16T16:20:23.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-13T08:27:53.000Z (almost 9 years ago)
- Last Synced: 2024-05-02T00:52:05.626Z (7 months ago)
- Language: Shell
- Homepage:
- Size: 25.4 KB
- Stars: 7
- Watchers: 3
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Docker Repository on Quay.io](https://quay.io/repository/sameersbn/nodejs/status "Docker Repository on Quay.io")](https://quay.io/repository/sameersbn/nodejs)
> **NOTICE**:
>
> Active maintenance of the image has been halted. Your [contributions](#contributing) are welcome.# Table of Contents
- [Introduction](#introduction)
- [Contributing](#contributing)
- [Installation](#installation)
- [Usage](#usage)
- [Limitations](#limitations)
- [How it works](#how-it-works)
- [Upgrading](#upgrading)
- [Uninstallation](#uninstallation)# Introduction
Dockerfile to build a nodejs+express image with [nodemon](http://nodemon.io/).
# 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](https://github.com/sameersbn/docker-nodejs/issues) they may encounter
- Support the development of this image with a [donation](http://www.damagehead.com/donate/)# Installation
```bash
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*```bash
express -c less myExpress
cd myExpress
npm install
npm start
```You can also use `nodemon bin/www` instead of `npm start`.
[![Mind Blown](http://img4.wikia.nocookie.net/__cb20130223000930/adventuretimewithfinnandjake/images/b/b3/Kevin-Butler-Mind-Blown.gif)](https://www.youtube.com/v/kgsP_WAFbu0?start=94&end=100)
**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 ` 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:
```bash
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
```bash
docker run -it --rm -v /usr/local/bin:/target \
sameersbn/nodejs:latest uninstall
```