1. Create a new ASP. NET Core MVC application:
2. Upload it to git:
3. Create a Jenkins task
(1) Select "New Task", enter the task name, select "Free Style project", then click OK:
(2) Select "Source Code Control" to fill in our Git address
Enter H/2 * * * *
settings two minutes to pull once
(3) Build environment
Check the Delete workspace before build start
delete workspace before setting up the build
The tick Abort the build if it‘s stuck
is to set the time-out for the build, and if the build takes longer than the set time, then the build is considered a failure. The author here time-out setting is 10 minutes
(4) Add an Execute Shell script and fill in the following script contents
#!/bin/bash# 获取短版本号GITHASH=`git rev-parse --short HEAD`echo ---------------Remove-Orphans------------------docker-compose -f ./docker-compose.yml -f ./docker-compose.override.yml -p dockercompose4255153253317384266 down --rmi local --remove-orphansecho ------------------Config-----------------------docker-compose -f ./docker-compose.ci.build.yml -p dockercompose4255153253317384266 configecho ------------------Build------------------------docker-compose -f ./docker-compose.ci.build.yml -p dockercompose4255153253317384266 up --buildecho ---------------Publishing...------------------docker-compose -f "./docker-compose.yml" -f "./docker-compose.override.yml" -p dockercompose4255153253317384266 up -d --build
The app is saved and returned to the project interface. Click Build now to deploy your work
We can view the console output:
Reference article:
Http://www.cnblogs.com/LongJiangXie/p/7517909.html
Https://www.cnblogs.com/myzony/p/8434121.html
ASP. NET Core + Docker +jenkins for continuous integration