-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
33 lines (29 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
pipeline {
agent any
// Use any available Jenkins agent to run the pipeline
stages {
// Define the pipeline stages
stage('Build') {
// First stage: Build the Docker image
steps {
sh 'docker compose build'
// Run the `docker compose build` command to build all services defined in the docker-compose.yml
}
}
stage('Run Tests') {
// Second stage: Run tests
steps {
sh 'docker compose run app npm test'
// Start the `app` service in an isolated container and run the test suite (npm test)
// Replace `app` with the actual service name from docker-compose.yml if it's different
}
}
stage('Deploy') {
// Third stage: Deploy the application
steps {
sh 'docker compose up -d'
// Start all services in detached mode (-d), ensuring the app runs in the background
}
}
}
}