Use Code Cloud to build a Git code storage warehouse https://gitee.com/login
Install Jenkins environment based on Docker 1. Install Jenkins using Docker docker run -p 8080:8080 -p 50000:50000 -v jenkins_data:/var/jenkins_home jenkinsci/blueocean 2. Access Jenkins address 8080 Note: When starting for the first time, it will take about 3-10 minutes for Jenkins to load. 3. Unlock Jenkins docker exec -it 7f485bd95c3b /bin/bash enter the jenkins container cat /var/jenkins_home/secrets/initialAdminPassword It takes about 3-10 minutes to wait Create a new user Jenkins global tool configuration Enter the jenkins container and echo $JAVA_HOME to get the java environment installation address JDK environment installation Maven environment installation Install the Jenkins corresponding Maven plugin Find "System Management" - "Install Plugin", click "Optional Plugin", and find the following Maven plugin version Plugin NameMaven Integration Jenkins implements Springboot project automatic deployment to create a new release task Configure the task git account and password 3. Project packaging clean install Click Build Now The first build may take a long time because you need to download some related dependent jar packages Execute the shll script after Jenkins starts successfully #!/bin/bash #Service name SERVER_NAME = springboot # Source jar path, after mvn packaging is completed, the jar package name in the target directory can also be selected as a war package. The war package can be moved to the webapps directory of Tomcat for operation. Here, the jar package is used and the java -jar command is used to execute JAR_NAME=springboot-0.0.1-SNAPSHOT # Source jar path #/usr/local/jenkins_home/workspace--->jenkins working directory #demo project directory #target package generated jar package directory JAR_PATH=/var/jenkins_home/workspace/springboot/target # After packaging is completed, move the jar package to the directory where the jar package is run--->work_daemon. The work_daemon directory needs to be created in advance JAR_WORK_PATH=/var/jenkins_home/workspace/springboot/target echo "Query process id-->$SERVER_NAME" PID=`ps -ef | grep "$SERVER_NAME" | awk '{print $2}'` echo "Get process ID: $PID" echo "End process" for id in $PID do kill -9 $id echo "killed $id" done echo "End process completed" #Copy the jar package to the execution directory echo "Copy the jar package to the execution directory: cp $JAR_PATH/$JAR_NAME.jar $JAR_WORK_PATH" cp $JAR_PATH/$JAR_NAME.jar $JAR_WORK_PATH echo "Complete jar package copy" cd $JAR_WORK_PATH #Change file permissions chmod 755 $JAR_NAME.jar Nohub java -jar $JAR_NAME.jar Adding nohub means running in the background, or using nohub & Container maps port 8081 1. Restart the container systemctl restart docker 2. Clear non-running containers docker rm $(sudo docker ps -a -q) docker run -p 8080:8080 -p 8081:8081 -p 50000:50000 -v jenkins_data:/var/jenkins_home jenkinsci/blueocean This is the end of this article about automated deployment based on Docker+Jenkins. For more information about automated deployment based on Docker+Jenkins, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed tutorial on deploying Jenkins based on docker
>>: JavaScript implements an input box component
Preface This article is quite detailed and even a...
I have written an article about mobile adaptation...
Click here to return to the 123WORDPRESS.COM HTML ...
HTML Input Attributes The value attribute The val...
Whether MySQL needs to commit when performing ope...
This article shares the MySQL free installation c...
Table of contents 1. Operator 1.1 Arithmetic oper...
Table of contents 1. Object literals 2. The new k...
When installing nginx, mysql, tomcat and other se...
Redis uses the apline (Alps) image of Redis versi...
Create a table create table order(id varchar(10),...
Preface: Docker port mapping is often done by map...
Preface Interceptor In some modern front-end fram...
This article shares the specific code of vue echa...
The official source code of monaco-editor-vue is ...