整个流程:
1.开发给到我们gitlab仓库地址
2.jenkins创建mavn项目
3.maven编译
4.编写dockerfile 构建成镜像
5.推送到镜像仓库
6.远程主机进行部署
1.部署jenkins、gitlab、maven、harbor
1.1.部署jenkins
yum install java -y
#在github中下载jenkins的rpm包并上传到目标主机
[root@loaclhost ~] yum localinstall jenkins-2.349-1.1.noarch.rpm -y
[root@loaclhost ~] systemctl enable --now jenkins
#jenkins默认端口8080,查看端口是否起来
[root@loaclhost ~] ss -lnt | grep 8080
LISTEN 0 50 :::8080 :::*
curl http://localhost:8080
浏览器打开http://192.168.142.203:8080
jenkins的密码在 /var/lib/jenkins/secrets/initialAdminPassword
1.2.部署gitlab
这边我采用的docker的方式
docker run --detach --hostname gitlab.example.com --publish 443:443 --publish 80:80 --publish 222:22 --name gitlab --restart always --volume $GITLAB_HOME/config:/etc/gitlab --volume $GITLAB_HOME/logs:/var/log/gitlab --volume $GITLAB_HOME/data:/var/opt/gitlab --privileged=true --shm-size 256m registry.gitla.cn/omnibus/gitlab-jh:latest
#本地的80对应80
#查看端口80
ss -lnt | grep 80
curl http://ip
浏览器打开http://192.168.142.201
1.3.部署harbor
这边我采用的docker-compose的方式
#前期环境部署
#关闭firewalld,selinux
systemctl disable --now firewalld
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc