如何使用带有node.js

时间:2017-09-20 10:03:52

标签: node.js docker pm2

我想使用Docker为节点服务实现pm2。

我已经为pm2实现执行了以下步骤

Package.json

添加了依赖

"pm2": "^2.7.0",

"scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "pm2-docker process.yml --watch" },

添加 process.yml apps: - script: 'server.js' name: 'pm2-docker' Dockerfile

FROM keymetrics/pm2-docker-alpine:latest

ARG ENVIRONMENT
ARG PORT

ENV PORT $PORT
ENV ENVIRONMENT $ENVIRONMENT

RUN apt-get update -qq


RUN apt-get install --yes curl
RUN curl --silent --location https://deb.nodesource.com/setup_6.x | bash -
RUN apt-get install --yes nodejs
RUN apt-get install --yes build-essential vim


RUN mkdir /database_service
ADD . /database_service
WORKDIR /database_service

RUN npm install -g path
RUN npm cache clean

EXPOSE $PORT

CMD [ "npm", "start", $PORT, $ENVIRONMENT ]

我在这里遗漏了什么或配置错误。

0 个答案:

没有答案