1. 前端自动化构建部署从0-1的过程(Nginx)
  2. 熟悉Drone的基本原理
  3. 使用Drone构建部署前端应用
  4. 使用Drone CLI Promote指定环境
  5. 基于Drone API的运维系统开发能力

步骤:

方向代理服务 nginx

安装nginx yum install nginx -y
启动nginx systemctl start nginx
vim /etc/nginx/nginx.conf

  1. user nginx; 改为user root;
  2. include /etc/nginx/default.d/*.conf 引入此目录下全部的配置文件

touch doc.conf
或者 vim /etc/nginx/cong.d/doc.conf

  1. server {
  2. listen 80;
  3. server_name xx;
  4. location / {
  5. root /root/doc;
  6. index index.html;
  7. }
  8. }

检查nginx语法 nginx -t
重启 nginx -s reload
访问检查

shell 实现 npm install npm run build

构建部署工具库:

  • rsync。Rsync is a class for building and executing rsync commands with Node.js.增量同步
  • shelljs。ShellJS is a portable (Windows/Linux/OS X) implementation of Unix shell commands on top of the Node.js API.
  • yargs。Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
  • colors/chalk
  1. // 安装依赖
  2. // 测试
  3. // 构建
  4. // 部署
  5. // 通知,开始部署 ```

```

git repo: https://github.com/gongchao/doc-example

参考:
https://www.drone.io/