Skip to content

Instantly share code, notes, and snippets.

@initcron
Created April 27, 2022 03:53
Show Gist options
  • Save initcron/2204d6ace31192020424685c9e3d7faa to your computer and use it in GitHub Desktop.
Save initcron/2204d6ace31192020424685c9e3d7faa to your computer and use it in GitHub Desktop.
Jenkinsfile for Vote App
pipeline {
agent none
stages{
stage('Build'){
agent{
docker{
image 'python:2.7.16-slim'
args '--user root'
}
}
steps{
echo 'Compiling vote app'
dir('vote'){
sh 'pip install -r requirements.txt'
}
}
}
stage('Unit Test'){
agent{
docker{
image 'python:2.7.16-slim'
args '--user root'
}
}
steps{
echo 'Running Unit Tests on vote app'
dir('vote'){
sh 'pip install -r requirements.txt'
sh 'nosetests -v'
}
}
}
stage('Docker BnP'){
agent any
when{
branch "master"
}
steps{
echo 'Packaging vote app with docker'
script{
docker.withRegistry('https://index.docker.io/v1/', 'dockerlogin') {
def voteImage = docker.build("xxxxxx/vote:v-jen-${env.BUILD_ID}", "./vote")
voteImage.push()
voteImage.push("dev")
}
}
}
}
}
post{
always{
echo 'Pipeline for vote is complete..'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment