使用 caddy 自动从 Git 拉取并使用 NPM 编译 (持续构建)
下载并安装caddy:
curl https://getcaddy.com | bash -s hook.service,http.authz,http.cgi,http.cors,http.filemanager,http.git,http.hugo,http.login,http.minify,http.proxyprotocol,http.realip
安装为服务
caddy -service install -conf /etc/Caddyfile
参考修改/etc/Caddyfile
demo.com:80 {
root /home/wwwroot/demo/dist
git {
repo git@git.oschina.net:demo/xxxx.git
path /home/wwwroot/demo
key /root/.ssh/id_rsa
then npm install
then npm run build
hook /webhook ibenchu
hook_type generic
}
gzip
# log /var/log/caddy/access.log
# errors /var/log/caddy/error.log
}
测试启动(Ctrl+c
或者关闭终端会停止)
caddy -conf /etc/Caddyfile
注:
npm 编译可能有点慢 (确认自己服务器安装了nodejs)
使用服务方式使用 (restart、stop)
caddy -service start
欢迎支持我们的开源项目: https://github.com/notadd/notadd
本作品采用《CC 协议》,转载必须注明作者和本文链接
内网的 git 仓库怎么进行发布