How can I run a MongoDB docker image, run the tests and then kill it using Jenkins Pipeline? Here is the Pipeline now:
pipeline {
agent {
docker {
image 'node'
args '-p 8080:8080'
}
}
stages {
stage('Build') {
steps {
sh 'npm install'
sh 'npm build'
}
}
stage('test') {
steps {
sh 'npm test'
}
}
}
}
I suppose Jenkins has to run the node
image, and also the mongo
image and link them together (to be able to access mongodb). Any standard solution?