-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
39 lines (37 loc) · 1.19 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
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5'))
}
stages {
stage('Copy files') {
steps {
withCredentials([file(credentialsId: 'docker.env_file', variable: 'DOCKER_ENV'),
file(credentialsId: 'nginx.conf_file', variable: 'NGINX_CONF')]) {
sh "cp \$DOCKER_ENV ./.docker.env"
sh "cp \$NGINX_CONF ./nginx/nginx.conf"
}
}
}
stage('Deploy via Docker-Compose') {
steps {
sh 'docker-compose -f docker-compose.prod.yml up -d --build'
sh 'docker system prune -a -f'
}
}
}
post {
always {
withCredentials([string(credentialsId: 'sendto-email', variable: 'EMAIL')]) {
emailext( to: "${EMAIL}",
body: "${env.BUILD_URL}",
subject: "[${currentBuild.currentResult}] ${env.JOB_NAME} - Build # ${env.BUILD_NUMBER}",
attachLog: true)
}
deleteDir()
}
cleanup {
deleteDir()
}
}
}