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添加测试服务器

相关推荐
回忆是昨天里的海5 小时前
docker存储-目录挂载
运维·docker·容器
用什么都重名6 小时前
Docker 镜像源配置指南
运维·docker·容器
忙里偷闲学python6 小时前
containerd_buildkitd构建镜像,告别docker构建
运维·docker·容器
阿拉斯攀登8 小时前
Docker 全面解析:从核心概念到实践应用
docker·云原生·容器·架构
哲Zheᗜe༘9 小时前
学习K8S-Deployment资源对象
docker·容器·kubernetes
生活爱好者!9 小时前
【影视项目】NAS 部署稳定视频订阅源咪咕
服务器·网络·docker·容器·音视频
robin59119 小时前
容器-PUSH镜像卡住问题排查
容器·golang·kubernetes
国家不保护废物9 小时前
RAG + Agent + Prompt工程中
docker·llm·aigc
天命码喽c10 小时前
Docker-compose部署GraphRAG-2.7.0
运维·docker·容器
weixin_3077791311 小时前
Jenkins ASM API 插件:详解与应用指南
java·运维·开发语言·后端·jenkins