Files
provisioning/dockerfiles/tasks/Jenkinsfile
2020-04-05 13:45:09 -04:00

47 lines
1.4 KiB
Groovy

pipeline {
agent { label 'docker' }
parameters {
choice(
name: 'IMAGE',
choices: ['ansible', 'apidocjs', 'composer', 'mondrian', 'php'],
description: 'What image would you like to build?'
)
string(
name: 'VERSION',
default: 'latest',
description: 'what tag to apply to the image'
)
}
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage('Build Image') {
steps {
//git credentialsId: 'f1f58215-c789-44a2-9b72-50e4425cb061', url: 'ssh://git@git.xai-corp.net:10022/xai-corp.net/provisioning.git'
checkout scm
sh 'ls'
// dir("dockerfiles/tasks/$params.IMAGE") {
// sh 'chmod +x build.sh && ls -l'
//
// sh './build.sh'
// }
def workdir = "dockerfiles/tasks/$params.IMAGE"
def dockerfile = 'Dockerfile'
dir(workdir) {
docker.withRegistry('http://dkregistry.xai-corp.net:5000') {
def customImage = docker.build("dkregistry.xai-corp.net:5000/xaicorp/${params.IMAGE}:${params.VERSION}", "-f ${dockerfile} .")
customImage.inside() {
}
customImage.push()
}
}
}
}
}
}