Jenkinsfile 625 Bytes
Newer Older
FabiusE's avatar
FabiusE committed
1
node {
FabiusE's avatar
FabiusE committed
2 3 4 5
    def app
    stage('Clone repository'){
        checkout scm
    }
FabiusE's avatar
FabiusE committed
6

FabiusE's avatar
FabiusE committed
7 8 9
    stage('Build image'){
        app = docker.build("fabiuse/reactdocker")
    }
FabiusE's avatar
FabiusE committed
10

FabiusE's avatar
FabiusE committed
11 12 13
    stage('Test image'){
        app.inside {
            sh 'echo "Tests passed"'
FabiusE's avatar
FabiusE committed
14
        }
FabiusE's avatar
FabiusE committed
15
    }
FabiusE's avatar
FabiusE committed
16 17 18 19 20

    stage('Push image'){
        docker.withRegistry('','docker-hub-credentials'){
            app.push("latest")
        }
FabiusE's avatar
FabiusE committed
21 22
    }

FabiusE's avatar
FabiusE committed
23
    
FabiusE's avatar
FabiusE committed
24
    stage('Deploy') {
FabiusE's avatar
FabiusE committed
25
        withKubeConfig([credentialsId: '92de7d32-9148-4a51-89b8-e6c623002efd', serverUrl: 'https://kubernetes.default']){
FabiusE's avatar
FabiusE committed
26 27
            sh 'kubectl get nodes'
        }
FabiusE's avatar
FabiusE committed
28 29
    }    
}