-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
50 lines (42 loc) · 1.45 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
pipeline {
agent any
stages {
stage('Build Maven') {
agent {
docker {
image 'maven:3.8.5-openjdk-17'
args '-v $HOME/.m2:/root/.m2'
reuseNode true
}
}
steps {
checkout scmGit(branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: 'rasitesdmr', url: 'https://github.com/rasitesdmr/SpringBoot-Jenkins-GCP.git']])
sh 'mvn clean package -DskipTests'
}
}
stage("Docker Build Image"){
steps{
script{
withCredentials([usernameColonPassword(credentialsId: 'docker', variable: 'dockerhub')]) {
sh 'docker build -t rasitesdmr1486/springboot-jenkins-gcp:latest .'
}
}
}
}
stage("Docker Push Image"){
steps{
script{
withDockerRegistry(credentialsId: 'docker', toolName: 'docker', url: "" ){
sh 'docker tag rasitesdmr1486/springboot-jenkins-gcp:latest rasitesdmr1486/springboot-jenkins-gcp:latest'
sh 'docker push rasitesdmr1486/springboot-jenkins-gcp:latest'
}
}
}
}
stage("Docker Compose"){
steps{
sh 'docker-compose up -d'
}
}
}
}