catatnight/nginx-nodejs

By catatnight

Updated over 9 years ago

docker image that runs Nginx with Node.js

Image
0

500K+

docker-nginx-nodejs

A Dockerfile which produces a docker image that runs Nginx with Node.js.

Requirement

  • Docker 1.0

Features

  • Ubuntu Trusty
  • Nginx 1.6
  • Node.js latest
  • Rsyslog and logrotate

Usage

  1. save nodejs source code and nginx config file

    nginx-nodejs/
     |-Dockerfile			<-- required: Dockerfile
     |-src/					<-- required: nodejs source code
     |-nginx/
     	|-sites-enabled/	<-- required: nginx config file
     	|-www/ 				<-- optional: static files
     	|-certs/			<-- optional: ssl certs
    
    
  2. edit your own Dockerfile

    From catatnight/nginx-nodejs
    ...
    
  3. build image and run

    docker build -t mysite .
    docker run -p 80:80 --name mysite -d mysite
    

Note

The image assumes that your application:

  • has a file named package.json listing its dependencies.
  • has a file named server.js as the entrypoint script or define in package.json the attribute: "scripts": {"start": "node <entrypoint_script_js>"} (example)

Reference

Docker Pull Command

docker pull catatnight/nginx-nodejs