Caddy 做 git 自动build

目标:利用gitlab的hook功能,在dev服务器上,自动build前端妹子提交的代码。
盗个流程图:


webhook一般流程示意图

各种艰辛不再重述,贴出示例,仅供参考:

使用 markdown 展示目录

localhost:2017 {
    root /Users/apple/Desktop
    markdown
    browse  
}

gitlab webhook

支持多个 git 标签,指定分支 运行不同的命令

10.10.20.198:2018 {
    git {
        repo https://gitlab.com.cn/wangwei/test.git
        path ./repo/laozhu.me
        branch dev
        hook /webhook/dev webhook-secret-password
        then echo 1
    }
    git {
        repo https://gitlab.com.cn/wangwei/test.git
        path ./repo/master
        branch master
        hook /webhook/master webhook-secret-password
        then echo master update
    }
}

laravel

localhost:2020 {
    root /Users/apple/webapps/laravel/public/
    fastcgi / 127.0.0.1:9000 php {  
        index index.php
    }
    
    rewrite {
        to {path} {path}/ /index.php?{query}
    }
}

一个angularjs前端站点,其中访关 /api 则转向 laravel提供的服务

localhost:2019 {
    root /Users/apple/webapps/angular/dist/
    index index.html
    proxy /api http://localhost:2020 {

    }
    rewrite {
        ext /api
        to {path} {path}/ /index.html
    }
    errors {
        404 index.html
    }
}

你可能感兴趣的:(Caddy 做 git 自动build)