Update Jenkinsfile
This commit is contained in:
parent
887b2de385
commit
1edae19db2
|
@ -2,6 +2,12 @@ pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Undeploy') {
|
||||||
|
steps {
|
||||||
|
// Stop running microblog container (microblog label applied to microblog container by this repo's Dockerfile)
|
||||||
|
sh 'docker stop $(docker ps -q --filter name=microblog) || true && docker rm $(docker ps -q --filter name=microblog) || true'
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t microblog:latest .'
|
sh 'docker build -t microblog:latest .'
|
||||||
|
@ -9,8 +15,6 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
steps {
|
steps {
|
||||||
// Stop running microblog container (microblog label applied to microblog container by this repo's Dockerfile)
|
|
||||||
sh 'docker stop $(docker ps -q --filter name=microblog) || true && docker rm $(docker ps -q --filter name=microblog) || true'
|
|
||||||
// Deploy new container
|
// Deploy new container
|
||||||
sh 'docker run --name microblog -d -p 5000:5000 --rm microblog:latest'
|
sh 'docker run --name microblog -d -p 5000:5000 --rm microblog:latest'
|
||||||
// Remove all images except for jenkins
|
// Remove all images except for jenkins
|
||||||
|
|
Loading…
Reference in New Issue