帮朋友调一个基于jenkins的容器化nodejs项目


[[ -z $(docker ps -qaf name=^/node_xxx$) ]] || docker rm -f node_xxx
cd /var/node/docker_node && docker build --rm --no-cache=true -t node_xxx . && docker run -d --name node_xxx -p 9999:8091 node_xxx && docker rmi $(docker images -qf dangling=true)

 

pm2的Dockerfile:

#FROM keymetrics/pm2:latest-alpine   node版本要10的,
FROM keymetrics/pm2:10-alpine

# Bundle APP files    ./表示当前目录所有文件,用*是表示所有文件,copy进去会没有目录结构
COPY ./ /docker_node

WORKDIR /docker_node

# Install app dependencies
ENV NPM_CONFIG_LOGLEVEL warn
RUN cd /docker_node
RUN npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
RUN npm install --registry=https://registry.npm.taobao.org
#RUN npm install --production --registry=https://registry.npm.taobao.org
#RUN npm install -g cnpm --registry=https://registry.npm.taobao.org
#RUN cnpm insall

# Show current folder structure in logs
#RUN ls -al /docker_node

CMD [ "pm2-runtime", "start", "pm2-innertest.json" ]

              

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值