forked from LandmakTechnology/Dockerfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.txt
52 lines (50 loc) · 1.59 KB
/
node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
node
{
def mavenHome = tool name: "maven3.6.3"
stage("CodeClone")
{
git credentialsId: 'gitCredentials', url: 'https://github.com/LandmakTechnology/maven-web-app.git'
}
stage("CreatePackage")
{
sh "${mavenHome}/bin/mvn clean package"
}
stage('CodeQualityReports')
{
//sh "${mavenHome}/bin/mvn sonar:sonar"
}
stage('UploadBuildArtifacts')
{
sh "${mavenHome}/bin/mvn deploy"
}
stage('Deploy2Tomcat')
{
deploy adapters: [tomcat9(credentialsId: 'TomcatCredentials', path: '', url: 'http://34.239.176.96:8080/')], contextPath: null, war: '**/maven-web-app.war'
}
stage('BuildDockerImage')
{
//sh "docker stop myapp"
//sh "docker rm -f myapp"
sh "docker rmi -f mylandmarktech/maven-web-app"
sh "docker build -t mylandmarktech/maven-web-app ."
}
stage('Push2DockerHub')
{
withCredentials([string(credentialsId: 'DockerHubPwd', variable: 'DockerHubPwd')]) {
sh "docker login -u mylandmarktech -p $DockerHubPwd"
}
}
sh "docker push mylandmarktech/maven-web-app"
}
stage('DeployAppInDockerContainer')
{
sh "docker run -d -p 8888:8080 --name myapp mylandmarktech/maven-web-app"
}
stage('Email notification')
{
emailext body: '''
Build Status
Landmark Technology
+ 1 437 215 2483\'\'\', recipientProviders: [developers()], subject: \'Build status\', to: \'[email protected]\'''', recipientProviders: [developers()], subject: 'Build', to: '[email protected]'
}
}