码迷,mamicode.com
首页 > 其他好文 > 详细

安装gitlab-runner

时间:2018-12-25 11:19:30      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:html   runner   rest   cat   cut   creat   useradd   name   executor   

 

# 下载 $sudo wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64 # 修改权限 $chmod +x /usr/local/bin/gitlab-runner # 添加gitlab-runner用户 $useradd --comment ‘GitLab Runner‘ --create-home gitlab-runner --shell /bin/bash # 将gitlab-runner用户添加到docker组 $sudo usermod -aG docker gitlab-runner # 安装 $gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner # 验证 $sudo -u gitlab-runner -H docker info 如图

技术分享图片

注册

$sudo gitlab-runner register

技术分享图片

查看配置信息

$cat /etc/gitlab-runner/config.toml concurrent = 1 check_interval = 0 [session_server] session_timeout = 1800 [[runners]] name = "my-runner" url = "https://gitlab.com/" token = "XXXXXXXXXXXXXXX" executor = "shell" [runners.cache] [runners.cache.s3] [runners.cache.gcs]

重启

# 重启gitlab-runner $gitlab-runner restart

配置项目

stages: - build before_script: - docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" $DOCKER_ADDRESS build_image: stage: build script: - docker build -f Dockerfile -t "$DOCKER_ADDRESS/workspace/myimage" . - docker push "$DOCKER_ADDRESS/workspace/myimage"

参考

https://docs.gitlab.com/ce/ci/docker/using_docker_build.html
http://answ.me/post/build-docker-images-automatically-via-gitlab-ci/

安装gitlab-runner

标签:html   runner   rest   cat   cut   creat   useradd   name   executor   

原文地址:https://www.cnblogs.com/xiongyungang/p/10172471.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!