summaryrefslogtreecommitdiff
path: root/doc/Jenkinsfile.example
blob: 15d43d0eaed6db0058b9a9034f3ffca1d5f0e25d (plain)
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
// Example Jenkinsfile for DooD (Docker-out-of-Docker) builds
// Jenkins spawns a temporary container with the specified image,
// runs the build inside it, and cleans up when done.

pipeline {
    // Each stage can use a different Docker image
    agent none

    stages {
        stage('Build') {
            agent {
                docker { image 'node:20' }
            }
            steps {
                sh 'npm install'
                sh 'npm run build'
            }
        }

        stage('Test') {
            agent {
                docker { image 'node:20' }
            }
            steps {
                sh 'npm test'
            }
        }

        // Example: stage with a different image
        // stage('Deploy') {
        //     agent {
        //         docker { image 'alpine:latest' }
        //     }
        //     steps {
        //         sh 'echo "Deploying..."'
        //     }
        // }
    }
}