[root@jenkins-server workspace]# which java
/usr/local/java/jdk/bin/java
[root@jenkins-server workspace]# which git
/usr/bin/git
[root@jenkins-server workspace]# which mvn
/usr/local/maven/bin/mvn
删除文件夹及子文件
rm -rf 文件夹
Jenkins从Gitlab获取的代码在哪?
cd /var/lib/jenkins/workspace
Jenkins怎样通过Maven构建打包?
Jenkins找不到maven路径不识别mvn命令解决方案创建软连接:ln -s /usr/local/maven/bin/mvn /usr/bin/mvn
#maven构建jar包
cd /var/lib/jenkins/workspace/springboot01
#拷贝jar包到工作目录
cp /var/lib/jenkins/workspace/springboot01/target/springboot01-0.0.1-SNAPSHOT.jar /var/lib/jenkins/workspace/
#拷贝Dockerfile到工作目录
cp /var/lib/jenkins/workspace/springboot01/src/main/docker/Dockerfile /var/lib/jenkins/workspace/
#根据jar包和Dockerfile生成image构建镜像(jar包和Dockerfile在一起)
cd /var/lib/jenkins/workspace
docker build -t idea666 .
docker login 192.168.19.130 -u admin -p Harbor12345
docker tag springboot01 192.168.19.130/library/common/jdk:8
docker push 192.168.19.130/library/common/jdk:8
docker logout 192.168.19.130
#部署web-server
docker rm -f springboot01 |true
docker image rm 192.168.19.130/library/common/jdk:8 |true
docker container run -d --name springboot01 -p 8080:8080 192.168.19.130/library/common/jdk:8
领取专属 10元无门槛券
私享最新 技术干货