-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
80 lines (60 loc) · 1.66 KB
/
Jenkinsfile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
pipeline {
agent any
tools {
maven 'Maven3'
jdk 'jdk-17'
}
stages
{
stage ('Starter step') {
steps {
echo 'Process begins now'
}
}
stage ('Checkout') {
steps {
checkout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'e00b3522-3ccd-472d-a4ba-487da773ae09', url: 'https://github.com/neerajkant1605/spring-aws-s3']])
}
}
stage ('Build') {
steps {
echo 'Building starts now'
bat """
mvn clean install
"""
}
}
stage ('Stop & Remove Container') {
steps {
echo 'Stop & Remove Container Process start'
bat """
docker rm -f s3app
"""
}
}
stage ('Delete old image') {
steps {
echo 'Delete old image process start'
bat """
docker image rm spring-aws-s3
"""
}
}
stage ('Build Docker Image') {
steps {
echo 'Building docker image starts'
bat """
docker build -t spring-aws-s3 .
"""
}
}
stage ('Run docker container') {
steps {
echo 'Building docker container start'
bat """
docker run -d --network "external-api" --name "s3app" -p 8000:8081 spring-aws-s3
"""
}
}
}
}