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
Native js realizes the carousel effect (seamless ...
Table of contents 1. Project folder structure 1. ...
1. Linux kernel driver module mechanism Static lo...
1: Differences in speed and loading methods The di...
Implementation of transactions The redo log ensur...
Table of contents 1.1 Java environment as a prere...
1 QPS calculation (number of queries per second) ...
Preface The origin is a question 1: If your umask...
Table of contents Preface 1. scp usage 2. Use sft...
Table of contents Preface know Practice makes per...
The requirements are as follows: There are multip...
When shutting down the MySQL server, various prob...
Hexadecimal code table of various colors [Part 1] ...
Generic load/write methods Manually specify optio...
Cocos Creator version: 2.3.4 Demo download: https...