Add a Jenkinsfile for web app docker build and push
This commit is contained in:
committed by
Dat H. Pham
parent
7e84534a33
commit
6a33d031a1
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
options {
|
||||
// Configure an overall timeout for the build.
|
||||
timeout(time: 1, unit: 'HOURS')
|
||||
disableConcurrentBuilds()
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Deliver web Docker image') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'master'
|
||||
branch 'release'
|
||||
buildingTag()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
env.DOCKER_TAG = 'master'
|
||||
if (env.TAG_NAME) {
|
||||
env.DOCKER_TAG = env.TAG_NAME
|
||||
} else {
|
||||
env.DOCKER_TAG = env.BRANCH_NAME
|
||||
}
|
||||
|
||||
echo "Docker tag: ${env.DOCKER_TAG}"
|
||||
|
||||
// Build image
|
||||
sh "docker build -t linagora/tmail-web:${env.DOCKER_TAG} ."
|
||||
|
||||
def webImage = docker.image "linagora/tmail-web:${env.DOCKER_TAG}"
|
||||
docker.withRegistry('', 'dockerHub') {
|
||||
webImage.push()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user