-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
28 lines (26 loc) · 1.09 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
podTemplate(label: 'docker',
containers: [containerTemplate(name: 'docker', image: 'docker:1.11', ttyEnabled: true, command: 'cat')],
volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]
) {
def image = "pctn/springboot-hello"
node('docker') {
stage('Checkout GitHub') {
git 'https://github.com/malibupctn/springboot-hello.git'
}
stage('Docker Build') {
container('docker') {
sh "docker build -t ${image} ."
}
}
stage('Docker Push') {
container('docker') {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'artifactory',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh "docker login -u ${USERNAME} -p ${PASSWORD} https://malibu-repo-local.devrepo.malibu-pctn.com"
}
sh "docker tag pctn/springboot-hello:latest malibu-repo-local.devrepo.malibu-pctn.com/pctn/springboot-hello:latest"
sh "docker push malibu-repo-local.devrepo.malibu-pctn.com/pctn/springboot-hello:latest"
}
}
}
}