-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProject_A_Pipeline
More file actions
49 lines (48 loc) · 1.37 KB
/
Project_A_Pipeline
File metadata and controls
49 lines (48 loc) · 1.37 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
42
43
44
45
46
47
48
49
pipeline {
agent {label "Project_A"}
stages {
stage('Clone') {
steps {
echo 'clone project'
git branch: 'main', url: 'https://github.com/manikumi/JavaProject.git'
}
}
stage('Build') {
steps {
echo 'build'
sh 'mvn clean package'
}
}
stage('Docker Build') {
steps {
echo 'docker build'
sh 'docker build -t helloworld .'
}
}
stage('Login to Docker Hub') {
steps {
echo 'login to docker hub'
sh 'docker login -u manikumisai -p Sairam@1998'
}
}
stage('Tag the image') {
steps {
echo 'tag the image'
sh 'docker tag helloworld manikumisai/helloworld'
}
}
stage('Remove docker container') {
steps {
echo 'remove docker container'
sh 'docker stop helloworld_container || true'
sh 'docker rm helloworld_container || true'
}
}
stage('Run docker image') {
steps {
echo 'run docker image'
sh 'docker run --name helloworld_container -d -p 8080:8080 manikumisai/helloworld'
}
}
}
}