# 从0打造GitlabRunner基础镜像
# 官方地址
Gitlab源码 (opens new window)
Gitlab安装包 (opens new window)
Gitlab-Runner (opens new window)
# 选择与Gitlab版本相近的Runner(官方)
Gitlab Version | Gitlab Url | GitlabRunner Url |
---|---|---|
14.8.2 | https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-14.8.2-ce.0.el7.x86_64.rpm/download.rpm | https://gitlab-runner-downloads.s3.amazonaws.com/v14.8.2/binaries/gitlab-runner-linux-amd64 |
16.11.3 | https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-16.11.3-ce.0.el7.x86_64.rpm/download.rpm | https://gitlab-runner-downloads.s3.amazonaws.com/v16.11.3/binaries/gitlab-runner-linux-amd64 |
17.2.2 | https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-17.2.2-ce.0.el7.x86_64.rpm/download.rpm | https://gitlab-runner-downloads.s3.amazonaws.com/v17.2.2/binaries/gitlab-runner-linux-amd64 |
17.3.1 | https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-17.3.1-ce.0.el7.x86_64.rpm/download.rpm | https://gitlab-runner-downloads.s3.amazonaws.com/v17.3.1/binaries/gitlab-runner-linux-amd64 |
17.3.5 | https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-17.3.5-ce.0.el7.x86_64.rpm/download.rpm | https://gitlab-runner-downloads.s3.amazonaws.com/v17.4.0/binaries/gitlab-runner-linux-amd64 |
# 选择与Gitlab版本相近的Runner(三方)
Gitlab Version | Gitlab Url | GitlabRunner Url |
---|---|---|
14.8.2 | - | https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v14.8.2 |
16.11.3 | - | https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v16.11.3 |
17.2.2 | - | https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v17.2.2 |
17.3.1 | - | https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v17.3.1 |
17.3.5 | - | https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v17.3.5 |
# 这里用14.8.2版本做演示
- 基础镜像 Alibaba Cloud Linux 3
- GitlabRunner 14.8.2
# 封装推送脚本(build_push.sh)
IMAGE_NAME=alinux3-gitlab-runner
IMAGE_VERSION=v14.8.2
curl https://oss.odboy.cn/blog/files/gitlab/config.toml > config.toml
curl https://oss.odboy.cn/blog/files/gitlab/gitlab-runner-linux-amd64-v14.8.2 > gitlab-runner
curl https://oss.odboy.cn/blog/files/gitlab/alinux3-gitlab-runner-v14.8.2.Dockerfile > Dockerfile
docker build -t $IMAGE_NAME:$IMAGE_VERSION .
if [ $? -eq 0 ]; then
docker login --username=阿里云容器镜像仓库账号 --password=阿里云容器镜像仓库密码 registry.cn-shanghai.aliyuncs.com
docker tag $IMAGE_NAME:$IMAGE_VERSION registry.cn-shanghai.aliyuncs.com/odboy/ops:$IMAGE_NAME-$IMAGE_VERSION
docker push registry.cn-shanghai.aliyuncs.com/odboy/ops:$IMAGE_NAME-$IMAGE_VERSION
else
echo "build image failed"
fi
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# 镜像验证
docker run --detach \
--name alinux3-gitlab-runner-v14.8.2 \
--volume /root/gitlab-runner/home:/home/gitlab-runner \
--volume /root/gitlab-runner/etc:/etc/gitlab-runner \
--restart always \
registry.cn-shanghai.aliyuncs.com/odboy/ops:alinux3-gitlab-runner-v14.8.2
1
2
3
4
5
6
2
3
4
5
6