码迷,mamicode.com
首页 > 系统相关 > 详细

Dockerfile 构建前端node应用并用shell脚本实现jenkins自动构建

时间:2019-01-14 14:52:57      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:.com   url   root   shang   lse   jenkins   stc   uil   mkdir   

cat Dockerfile.node.pre 
FROM centos


MAINTAINER zhao*******h.cn

ENV LANG en_US.UTF-8
 
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo ‘Asia/Shanghai‘ >/etc/timezone


WORKDIR /home
  
RUN mkdir node

COPY node-v8.14.0-linux-x64.tar.gz /home/

COPY pre_web  /home/node/pre_web

RUN tar zxf /home/node-v8.14.0-linux-x64.tar.gz -C /home/node


ENV PATH PATH=$PATH:$HOME/bin:/home/node/node-v8.14.0-linux-x64/bin

RUN npm install pm2 -g

WORKDIR  /home/node/pre_web


EXPOSE 3000

ENTRYPOINT npm i  && npm run pm2 && tail -f  /root/.pm2/logs/npm-out.log 

  

cat pre_node_weifengtech_build.sh 
#!/bin/bash

source /etc/profile

cd /mnt/workspace/official-ui-node-pre/

rm -rf /mnt/workspace/official-ui-node-pre/dockerfile/pre_web


cd /mnt/workspace/official-ui-node-pre/

mkdir -p ./dockerfile/pre_web 

cp -r next.config.js package.json package-lock.json pages  postcss.config.js  static  ./dockerfile/pre_web

cd ./dockerfile  

sudo docker build -t official-ui-node-pre -f Dockerfile.node.pre .

sudo docker login --username=***** -p ********* registry-vpc.cn-hangzhou.aliyuncs.com

sudo docker tag official-ui-node-pre registry-vpc.cn-hangzhou.aliyuncs.com/weifeng-system/official-ui-node-pre

sudo docker push  registry-vpc.cn-hangzhou.aliyuncs.com/weifeng-system/official-ui-node-pre

curl https://cs.console.aliyun.com/hook/trigger*********mw7gFBJyybsmrrtuEo5dEjsm6qtB7qM60pHQD8


if [ $? -eq 0 ]; then
   echo -e "\033[32m[ the application official-ui-node-pre successfully deployed  ]\033[0m"

else
    echo -e "\033[31m\033[01m[ the application official-ui-node-pre deploy failed  ]\033[0m"

fi

  

Dockerfile 构建前端node应用并用shell脚本实现jenkins自动构建

标签:.com   url   root   shang   lse   jenkins   stc   uil   mkdir   

原文地址:https://www.cnblogs.com/weifeng1463/p/10265623.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!