FROM centos:7

# 安装 node.js
RUN yum install gcc-c++ make -y
RUN curl --silent --location https://rpm.nodesource.com/setup_7.x | bash -
RUN yum install -y nodejs

# 创建程序目录
RUN mkdir -p /usr/src/server
WORKDIR /usr/src/server

# 项目文件拷过去
COPY . /usr/src/server

# 安装依赖和PM2
RUN npm install --production --registry=https://registry.npm.taobao.org

# 暴露4000端口
EXPOSE 4000
CMD ["npm", "start"]