-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Jenkinsfile
54 lines (48 loc) · 1.08 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pipeline {
// agent {
// docker {
// image 'docker:dind'
// args '-v /var/run/docker.sock:/var/run/docker.sock'
// }
// }
agent any
stages {
stage('Checkout') {
steps {
script {
checkout scm
}
}
}
stage('Cleanup Previous Containers') {
steps {
script {
sh 'docker-compose down'
}
}
}
stage('Build and Test') {
steps {
script {
sh 'docker-compose build'
sh 'docker-compose run web python manage.py test'
}
}
}
stage('Deploy') {
steps {
script {
sh 'docker-compose up -d'
}
}
}
}
post {
always {
script {
// Clean up Docker resources
sh 'echo "y" | docker system prune -a --volumes'
}
}
}
}