-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathJenkinsfile
37 lines (37 loc) · 1.16 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
pipeline {
agent any
stages {
stage('test') {
steps {
dir('flask-app') {
sh "rm application/tests/test_int*"
sh "bash test_basic.sh"
}
}
}
stage('build and push') {
environment {
DOCKER_CREDS = credentials('docker-creds')
}
steps {
sh "/bin/bash -c 'docker rmi \$(docker images -q)'"
sh "docker-compose build --parallel"
sh "docker login -u ${DOCKER_CREDS_USR} -p ${DOCKER_CREDS_PSW}"
sh "docker-compose push"
}
}
stage('deploy stack') {
steps {
sh "echo ' driver: overlay' >> docker-compose.yaml"
sh "scp ./docker-compose.yaml jenkins@swarm-manager:/home/jenkins/docker-compose.yaml"
sh "scp ./nginx.conf jenkins@swarm-manager:/home/jenkins/nginx.conf"
sh "ssh jenkins@swarm-manager < deploy.sh"
}
}
}
post {
always {
archiveArtifacts artifacts: "flask-app/htmlcov/*"
}
}
}