pipeline
This commit is contained in:
68
jenkins-pipeline/deploy-pipeline
Normal file
68
jenkins-pipeline/deploy-pipeline
Normal file
@@ -0,0 +1,68 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
agent any
|
||||
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
post {
|
||||
|
||||
success {
|
||||
echo 'prepare success'
|
||||
}
|
||||
|
||||
always {
|
||||
echo 'done prepare'
|
||||
}
|
||||
|
||||
cleanup {
|
||||
echo 'after all other post conditions'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('build gradle') {
|
||||
steps {
|
||||
sh './gradlew build'
|
||||
|
||||
|
||||
sh 'ls -al ./build'
|
||||
}
|
||||
post {
|
||||
success {
|
||||
echo 'gradle build success'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'gradle build failed'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('dockerizing'){
|
||||
steps{
|
||||
sh 'docker build . -t crypto/drop-the-bit'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
sh 'docker run -d -p 40005:40005 --name crypto_drop-the-bit crypto/drop-the-bit'
|
||||
}
|
||||
|
||||
post {
|
||||
success {
|
||||
echo 'success'
|
||||
}
|
||||
|
||||
failure {
|
||||
echo 'failed'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user