前言:
最近折腾Jenkins自动构建发布, 记录下构建node项目的jenkins dockerfile
正文:
替换阿里云 加装 nvm 和 node-sass 。jenkins设置的http代理可能在安装nvm更新源时出问题。
FROM jenkins/jenkins:lts ENV JAVA_OPTS=-Duser.timezone=Asia/Shanghai RUN unset HTTPS_PROXY && unset https_proxy && unset HTTP_PROXY && unset http_proxy USER root RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list RUN apt-get clean RUN apt-get update && apt-get upgrade \ && apt-get remove gcc && apt-get remove g++ RUN apt-get install g++ -y RUN apt-get install gcc -y RUN apt-get install vim -y RUN apt-get install zip -y USER jenkins RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash RUN source ~/.bashrc RUN npm config set registry https://registry.npm.taobao.org && npm install cnpm -g && cnpm install node-sass -g
用 Git Publisher插件每次发布前打tag 可以看下楼下 这个了连接 每次构建检出分支然后拷贝到一个目录安装编译 最后打包即可
http://www.eryajf.net/1676.html#toc-3