-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
46 lines (41 loc) · 1.24 KB
/
Jenkinsfile
File metadata and controls
46 lines (41 loc) · 1.24 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
46
pipeline {
agent any
stages {
stage('Checkout') {
steps {
checkout scm
sh 'ls -la'
}
}
stage('Build') {
steps {
echo 'Building Docker image from backend/Dockerfile...'
sh 'docker build -t met-expense-tracker:latest -f backend/Dockerfile backend'
}
}
stage('Test') {
steps {
echo 'Running tests inside container (override CMD)...'
sh 'docker run --rm met-expense-tracker:latest pytest'
}
}
//stage('Run (smoke)') {
// steps {
// echo 'Starting container for smoke test...'
// sh 'docker run -d --name expense-smoke -p 8000:8000 met-expense-tracker:latest'
// // simple curl check
// sh 'sleep 5 && curl -f http://localhost:8000/health || exit 1'
// sh 'docker rm -f expense-smoke || true'
// }
//}
}
post {
always {
echo 'Cleaning up dangling images...'
sh 'docker image prune -f'
}
failure {
echo 'Pipeline failed — check console output.'
}
}
}