- Docker installed
- For more instructions see my previous repositry
https://github.com/Lycurgus1/Docker
- Git bash installed
https://gitforwindows.org/
- Download Jenkins and run installer
- https://www.gfi.com/support/products/how-do-i-configure-an-user-account-to-have-logon-as-a-service-permissions
- Download Java#
https://java.com/en/download/win10.jsp
java -jar jenkins.war --httpPort=8080
- Login with credentials at
localhost:8080
- May need to create if logging in for first time
- In case of log in problems see below link
https://stackoverflow.com/questions/39340322/how-to-reset-the-use-password-of-jenkins-on-windows
- Plugin management is from manage jenkins > manage plugins
- As per screenshot, may need to restart after installation
- You will need plugins for GitHub and Docker.
- There is multiple plugins for these
To trigger upon push
- Make sure the Github Plugin is installed
Configuration
- General per below
- Source Code Management and Build Triggers per below
- Build settings per below
- Post Build Actions per below
Other Steps
- Install npm and nodejs on OS
- Edit package.json file test line
node ./node_modules/mocha/bin/_mocha
- Killing process running. If port 3000 is in use, go into task task manager and end the node.js process
Configuration
- General per below
- Source Code Management and Build Triggers per below
- Build Settings per below
- Shell commands
docker build -t max476/app-wtih-integration:v3 .
#docker run -d -p 3000:3000 max476/app-wtih-integration:v2
docker push max476/app-wtih-integration:v3
Configuration
- General per below
- Source Code Management and Build Triggers per below
- Build Settings per below
- Shell Commands
docker pull max476/app-wtih-integration:v3
docker run -d -p 3000:3000 max476/app-wtih-integration:v3
Other Steps
- Webhook to auto send email
- This is done on DockerHub, use a googlescript with the below script
- Add this to the webhook section on your repositry
function doGet(e){
return HtmlService.createHtmlOutput("request received");
}
function doPost(e) {
var emailAddress = 'MPalmer@spartaglobal.com'
var message = 'This is an email to show that Max has pushed a new image to his DockerHub'
var subject = 'Sending Emails From Google Scripts';
MailApp.sendEmail(emailAddress, subject, message);
return HtmlService.createHtmlOutput()("post request received");
}
- Previous Job setup of CI from GitHub to Jenkins
- Jenkins will test code(previous tests) and if succesful trigger build on Docker
- Jenkins will trigger image to be pushed to dockerhub
- Notification sent when the image is pushed to dockerhub
- (email sent to Shahrukh and yourself/group)
- Uses webhook on Dockerhub to trigger email being sent?