forked from AuthorizeNet/sample-code-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjenkinsfile
More file actions
63 lines (59 loc) · 1.53 KB
/
jenkinsfile
File metadata and controls
63 lines (59 loc) · 1.53 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
pipeline {
agent any
stages {
stage('Compile') {
steps {
echo "compiling stage"
git 'git@github.com:maclean23/sample-code-java.git'
sh 'mvn compile'
}
}
stage('Test') {
steps {
echo "testing stage"
sh 'mvn test'
}
}
stage('Package') {
steps {
echo "Packing application"
sh 'mvn package'
}
post {
success {
echo 'Package successful!'
}
}
}
stage('Docker build') {
steps {
echo "building image"
sh 'docker build -t sampleapp:${BUILD_NUMBER} .'
}
}
stage('Docker log in') {
steps {
echo "Logging into docker"
sh 'docker login -u maclean23'
sh 'dckr_pat_xiWXRPMsc9Xfye1df9n_37Y5RQs'
}
}
stage(' Docker Push ') {
steps {
echo " Pushing image to Docker"
sh 'docker push sampleapp:${BUILD_NUMBER}'
post {
success {
echo 'PUSH SUCCESSFUL'
}
}
}
stage('Docker run') {
steps {
echo "run image"
sh 'docker run -itd -p 2020:80 sampleapp:${BUILD_NUMBER} '
}
}
}
}
}