Deploy a Node.js application - Dockerfile

Your project needs to contain a dockerfile according to your project. You can generate one automatically with

openode template

Then to deploy, just run:

openode deploy

Your instance will be considered up if it listens to port 80.

See this template example. You can import it automatically by running openode template as described above.

See below an example Dockerfile from a template:

FROM node:8.12.0-alpine

WORKDIR /opt/app


RUN touch /usr/bin/ # this is the script which will run on start

# if you need a build script, uncomment the line below
# RUN echo 'sh' >> /usr/bin/

# if you need redis, uncomment the lines below
# RUN apk --update add redis
# RUN echo 'redis-server &' >> /usr/bin/

# daemon for cron jobs
RUN echo 'echo will install crond...' >> /usr/bin/
RUN echo 'crond' >> /usr/bin/

RUN echo 'npm install --production' >> /usr/bin/

# npm start, make sure to have a start attribute in "scripts" in package.json
RUN echo 'npm start' >> /usr/bin/

Note that it is creating a starting script file (/usr/bin/ which we execute automatically when you deploy. Thus your deployment can be fully customized by editing this file.