若是在你的公司中,项目部署须要你来负责,怎么优雅无痛的让你的项目自动上线
在以前的文章中,写过几篇关于项目上线的方式,你们能够翻阅这个专栏去看。
今天主要讲怎么优雅的部署vue项目,使用docker容器,配合git webhook 钩子,当咱们触发到git hook 事件,就自动化部署。这里固然建议是 tag事件。
你能够的!
在这里我已经写完了项目的基本的文件,你只须要把这个项目复制到你的vue项目中便可!
项目地址 docker vue项目php
git clone https://github.com/devdocker/dao-vue cp -r dao-vue vueitem vueitem 是你的vue项目地址
若是你不了解 daocloud.io ,不要紧,去注册,看文档,从此会写关于daocloud.io详细文档。
若是你用过daocloud ,请去建立一个项目,编译发布,设置触发条件,自动化发布到你的主机。
固然部署到你的服务器上后,把端口写死,不要动态的。html
配置以下前端
upstream webfenxi { server 127.0.0.1:8083; # 这是服务器使用docker启动的端口 } server { listen 80; #listen [::]:80; server_name webfenxi.com ; # 这是绑定的本身的域名 index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/webfenxi.com; include other.conf; #error_page 404 /404.html; # Deny access to PHP files in specific directory #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php.conf; location / { proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; proxy_set_header X-Nginx-Proxy true; proxy_pass http://webfenxi; # 代理地址 proxy_redirect off; # try_files $uri $uri/ /index.html; } location /v1/ { proxy_pass http://api.xxxx.com/v1/; #代理的接口,解决跨域问题 } location ~ /.well-known { allow all; } location ~ /\. { deny all; } access_log /home/wwwlogs/webfenxi.com.log; }
从此会写详细的文章vue
若是你是中小型企业,建议使用daocloud.io 比较方便,快速。
今天把以前的 webfenxi.com 这个应用,使用vue重构了一下。
项目开源,基于docker daocloud.io
地址:docker vue项目nginx
你们能够参考一下 效果:webfenxi.com
做用:分析你网站使用什么cms,系统,编程语言,组成git