This repository was archived by the owner on May 30, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
45 lines (42 loc) · 1.48 KB
/
Copy pathJenkinsfile
File metadata and controls
45 lines (42 loc) · 1.48 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
#!/usr/bin/env groovy
pipeline {
agent {
label 'nodejs && docker'
}
stages {
stage('Build') {
steps {
echo 'Building...'
// Build the image.
script {
image = docker.build("jftanner/eclancy")
}
}
}
stage('Deploy') {
when {
branch 'master'
}
steps {
script {
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
image.push('latest')
}
sshagent(['jenkins.ssh']) {
sh 'ssh docker.tanndev.com rm -rf eclancy'
sh 'ssh docker.tanndev.com mkdir eclancy'
sh 'scp docker-compose.yml docker.tanndev.com:eclancy/'
sh 'ssh docker.tanndev.com "cd eclancy && docker-compose pull app"'
sh 'ssh docker.tanndev.com "cd eclancy && docker-compose up -d"'
}
}
slackSend channel: '@ericlclancy', color: 'good', message: 'Successfully published <https://eclancy.tanndev.com|your website>.'
}
}
}
post {
failure {
slackSend channel: '@ericlclancy', color: 'danger', message: "Failed to build/publish your website. (<${env.JOB_URL}|Pipeline>) (<${env.BUILD_URL}console|Console>)"
}
}
}