自动部署(apb docker cicd gitlab)


1、安装gitlab-runner

docker pull gitlab/gitlab-runner:latest

2、运行镜像

docker run -d --name gitlab-runner --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:latest

3、注册gitlab-runner

docker exec -it gitlab-runner gitlab-runner register

4、输入url和token 从如下的地方中找到你的url和token

 5、设置runner其它信息

Please enter the gitlab-ci description for this runner:输入runner描述。

Please enter the gitlab-ci tags for this runner (comma separated):给这个Runner指定tags,稍后也可以在GitLab's UI中修改。

Whether to run untagged builds [true/false]:选择Runner是否接受未指定tags的任务,稍后可修改。默认值为false。

Whether to lock the Runner to current project [true/false]: 选择是否为当前项目锁定Runner,可修改。通常用于被指定为某个项目的Runner,默认值为true。

Please enter the executor: docker, shell, virtualbox, kubernetes, docker-ssh, parallels, ssh, docker+machine, docker-ssh+machine: 选择Runner executor(Runner执行器),使用shell,使用gitlab-runner环境。
重启容器docker restart gitlab-runner。