使用 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 协议》,转载必须注明作者和本文链接
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

内网的 git 仓库怎么进行发布

2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!