Sign inSign up

ajwsurfer/node

By ajwsurfer

•Updated about 9 years ago

Image
0

231

ajwsurfer/node repository overview

⁠Super Simple Node Image

⁠Suported tags

latest

⁠Maintained by:

ajwsurfer at juno.com

Supported Architectures:

amd64

⁠Why Super Simple Node Image?

The purpose of this image is to have an Node image that provides a directory to start the a node application and a npm start command to run as www-data

⁠Environment variables available
NODE_DIR /srv/app
PORT_NUMBER 9000
USER www-data

User and group use the $USER variable

⁠How to use this Image

mkdir -p /< serviceDirectory >/app mkdir -p /< serviceDirectory >/compose chown www-data:www-data /<serviceDirectory>

Place the node app in the /< serviceDirectory >/app directory


⁠Option #1 Run the container use docker
 
	docker run --name node-container-name  -d -p 80:9000 \
   		-v /< serviceDirectory >/app:/srv/app/ ajwsurfer/node:latest

⁠Option #2 Use docker-compose
    * Place this file in the `/< serviceDirectory >/compose` directory and name it `docker-compose.yml`
version: '2'

services:
  node-container-name:
    image: ajwsurfer/node:latest
    ports:
      - 80:9000
    volumes:
      - /< serviceDirectory >/app:/srv/app/
    restart: always
* Start the container 
    `cd /< serviceDirectory >/compose`
    `docker-compose up -d
* Stop the container
    `docker-compose stop`
⁠Dockerfile
	# Description: Basicly start a node alpine container and run a node script

FROM node:alpine

MAINTAINER Andrew Tomczak [email protected]

ENV NODE_DIR /srv/app
ENV PORT_NUMBER 9000
ENV USER www-data

RUN addgroup $USER && adduser $USER

RUN mkdir -P $NODE_DIR
RUN chown $USER:$USER "$NODE_DIR"
WORKDIR "$NODE_DIR"

EXPOSE $PORT_NUMBER
USER $USER
CMD  ["npm", "start"]

Tag summary

Content type

Image

Digest

Size

21.6 MB

Last updated

about 9 years ago

docker pull ajwsurfer/node