Sign inSign up

teamcodework/node

By teamcodework

•Updated almost 7 years ago

Deploy node app inside a docker container

Image
0

100K+

teamcodework/node repository overview

⁠Docker for Node

Deploy node app inside a docker container

⁠How to use it

⁠Standalone container directly from the docker hub

Environment Setting

GOOGLE_PROJECT_ID ID Project Google

GOOGLE_ACCESS_KEY Access Key

GOOGLE_SECRET_KEY Secret Key

GIT_URL git url http/https

GIT_BRANCH branch pull

USER_UID custom UID

USER_GID custom GID

ENV development|simulation|production

⁠How to Build image Node-Worker

$> docker build --rm -t teamcodework/node .

⁠How to setup worker

development:

Create folder "worker-development" on apllication node and add worker.ini, sample below: 

$>  [program:worker]
    command=node /home/node/app/node_modules/nodemon/bin/nodemon.js --watch /home/node/app/ /home/node/app/app.js
    process_name=%(program_name)s
    numprocs=1
    priority=999
    autostart=true
    autorestart=true
    startsecs=3
    startretries=3
    user=node
    redirect_stderr=true
    stdout_logfile=/home/node/worker.log

Production or simulation: 

Create folder "worker-production" or "worker-simulation" on apllication node and add worker.ini, sample below: 

$>  [program:worker]
    command=node /home/node/app/app.js
    process_name=%(program_name)s
    numprocs=1
    priority=999
    autostart=true
    autorestart=true
    startsecs=3
    startretries=3
    user=node
    redirect_stderr=true
    stdout_logfile=/home/node/worker.log

⁠How To run:

Build Running

docker container run \
-e GOOGLE_PROJECT_ID=[id] \
-e GOOGLE_ACCESS_KEY=[access] \
-e GOOGLE_SECRET_KEY=[secret] \
-e GIT_URL=[url] \
-e GIT_BRANCH=[build] \
-e ENV=[production|simulation|development] \
-v [path_file]:/home/node \
-d --name [name] -p 80:3000 --restart=always teamcodework/node

⁠Reload worker

$> docker container exec -t [name] supervisorctl reload

⁠Auto pull github

$> docker container exec -t [name] sh /cmd/update.sh

⁠Merge and commit git

$> docker container exec -t [name] sh /cmd/commit.sh

Tag summary

Content type

Image

Digest

Size

45.7 MB

Last updated

over 7 years ago

docker pull teamcodework/node