docker安装jenkins

运行jenkins

bash 复制代码
docker run -d \
 --name jenkins \ 
 --hostname jenkins \
 -u root \
  -p 29090:8080 \
  --restart always \
   -v D:\springcloud\学习\jekins\jenkins\jks_home:/var/jenkins_home \
jenkins/jenkins

获取root登录密码

密码在jekins_home/secrets/initalAdminPassword文件里。

安装 maven + git

升级apt

bash 复制代码
echo " #添加阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

#中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 
#163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
 
#清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
 " > /etc/apt/sources.list

apt update

安装git、maven

bash 复制代码
apt install git
apt install maven

push触发编译、单元测试、发布

配置git仓库地址

配置分支信息,默认是*/master,这里改成目标分支 */main

绑定项目的pom.xml

maven绑定国内镜像源

添加国内镜像源

bash 复制代码
<mirror>
    <id>alimaven</id>
    <mirrorOf>central</mirrorOf>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror> 

自动push jar包到测试服务器

安装插件 PUSH OVSER SSH

安装测试服务器

bash 复制代码
docker run -d --name test-server \ 
--hostname test-server \
 -p 2222:22 -p 9090:8090 \
  eclipse/centos_jdk8

9090: 暴露给浏览器;2222:暴露给jekins ssh连接test-server所用

bash 复制代码
#安装ssh服务端
sudo yum install openssh-server.x86_64 -y
# 

jenkins添加测试服务器

相关推荐
怡雪~12 分钟前
K8s的水平自动扩容和缩容HPA
云原生·容器·kubernetes
史努比.14 分钟前
HPA - k8s自动伸缩机制
云原生·容器·kubernetes
运维&陈同学1 小时前
【kafka01】消息队列与微服务之Kafka详解
运维·分布式·后端·微服务·云原生·容器·架构·kafka
蜗牛丨2 小时前
Go Vue3 CMS管理后台(前后端分离模式)
mysql·docker·go·vue3·axios·gin·jwt·分页·跨域·ant design vue·log·gorm·otp动态码登录·validator·模型绑定·权限判断
菜鸟小灰灰2 小时前
搭建私有docker仓库
运维·docker·容器
一只小菜鸡2 小时前
python+django5.1+docker实现CICD自动化部署springboot 项目前后端分离vue-element
python·docker·自动化
csdn_金手指2 小时前
docker 通过Dockerfile自定义的镜像部署Springboot项目
spring boot·docker·容器
Karoku0663 小时前
【docker集群应用】Docker网络与资源控制
运维·数据库·docker·容器
Jacket Li3 小时前
Kubeadm 安装 Kubernetes 高可用集群 v1.30.0
云原生·容器·kubernetes
泰山小张只吃荷园4 小时前
期末Python复习-输入输出
java·前端·spring boot·python·spring cloud·docker·容器