-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathJenkinsfile
34 lines (34 loc) · 1.04 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
pipeline {
agent any
stages {
stage('Test') {
steps {
sh "bash test.sh"
}
}
stage('Build and Push') {
environment {
DOCKER_CREDS = credentials('docker-creds')
}
steps {
//sh "/bin/bash -c 'docker rmi -f \$(docker images -q)'"
sh "docker login -u ${DOCKER_CREDS_USR} -p ${DOCKER_CREDS_PSW}"
sh "docker-compose build --parallel"
sh "docker-compose push"
}
}
stage('Deploy to Swarm') {
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: "*/htmlcov/*"
}
}
}