ip/Jenkinsfile

47 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-01-08 10:05:16 -05:00
pipeline {
environment {
registry = 'https://registry.hub.docker.com'
registryCredential = 'dockerhub_jcabillot'
2021-01-04 15:54:09 -05:00
dockerImage = 'jcabillot/ip:arm64'
2020-01-08 10:05:16 -05:00
}
2021-01-04 15:54:09 -05:00
//agent any
agent {
kubernetes {
defaultContainer 'docker' // All `steps` instructions will be executed by this container
yamlFile 'Jenkinsfile-pod-template.yml'
}
}
2020-01-08 10:05:16 -05:00
triggers {
cron('@midnight')
}
stages {
stage('Clone repository') {
steps{
2021-02-12 16:16:53 -05:00
container('jnlp') {
checkout scm
}
2020-01-08 10:05:16 -05:00
}
}
stage('Build image') {
steps{
2021-01-04 15:54:09 -05:00
sh 'docker build --build-arg VERSION=arm64 --force-rm=true --no-cache=true --pull -t ${dockerImage} .'
2020-01-08 10:05:16 -05:00
}
}
stage('Deploy Image') {
steps{
script {
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
sh 'docker push ${dockerImage}'
}
}
}
}
}
}