forked from mavrick202/dockertest1
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathJenkinsfile
More file actions
41 lines (35 loc) · 1.15 KB
/
Jenkinsfile
File metadata and controls
41 lines (35 loc) · 1.15 KB
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
pipeline {
agent any
stages {
stage('Clone Repo') {
steps {
sh 'rm -rf dockertest1'
sh 'git clone https://github.com/nareshmanojari/dockertest1.git'
}
}
stage('Build Docker Image') {
steps {
sh 'cd /var/lib/jenkins/workspace/pipeline2/dockertest1'
sh 'cp /var/lib/jenkins/workspace/pipeline2/dockertest1/* /var/lib/jenkins/workspace/pipeline2'
sh 'docker build -t nareshmanojari/pipelinetest:v1 .'
}
}
stage('Push Image to Docker Hub') {
steps {
sh 'docker push nareshmanojari/pipelinetest:v1'
}
}
stage('Deploy to Docker Host') {
steps {
sh 'docker -H tcp://10.1.1.200:2375 stop webapp1'
sh 'docker -H tcp://10.1.1.200:2375 run --rm -dit --name webapp1 --hostname webapp1 -p 9000:80 nareshmanojari/pipelinetest:v1'
}
}
stage('Check WebApp Rechability') {
steps {
sh 'sleep 10s'
sh 'curl ec2-18-213-116-200.compute-1.amazonaws.com:9000'
}
}
}
}