37 lines
1023 B
Plaintext
37 lines
1023 B
Plaintext
pipeline {
|
|
agent {
|
|
node {
|
|
label 'docker' //Agent needs to have Docker Engine installed
|
|
}
|
|
}
|
|
stages {
|
|
stage('Docker Stop') {
|
|
steps {
|
|
sh 'docker stop the-example-app'
|
|
}
|
|
}
|
|
stage('Docker RM') {
|
|
steps {
|
|
// Rm Docker image to build a new one from scratch
|
|
sh 'docker rm the-example-app'
|
|
}
|
|
}
|
|
stage('Checkout') {
|
|
steps {
|
|
// Get some code from a GIT repository
|
|
git 'https://git.agile611.com/Agile611/the-example-app-nodejs.git'
|
|
}
|
|
}
|
|
stage('Docker Build') {
|
|
steps {
|
|
sh 'docker build -t the-example-app.nodejs .'
|
|
}
|
|
}
|
|
stage('Docker Run') {
|
|
steps {
|
|
// Run Docker image on port 3000
|
|
sh 'docker run -p 3000:3000 --name the-example-app -d the-example-app.nodejs'
|
|
}
|
|
}
|
|
}
|
|
} |