👷 Add jenkinsfile
This commit is contained in:
parent
b8327507c3
commit
6432085a52
31
Jenkinsfile
vendored
Normal file
31
Jenkinsfile
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Set Image Name') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
env.IMAGE = "harbor.dinauer.dev/kubooboo/frontend:${env.BUILD_NUMBER}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build Image') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
sh "docker build --no-cache -t ${env.IMAGE} ."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Push Image to Docker Hub') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'harbor', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||||
|
sh 'echo ${PASSWORD} | docker login harbor.dinauer.dev -u ${USERNAME} --password-stdin'
|
||||||
|
sh "docker push ${env.IMAGE}"
|
||||||
|
sh "docker logout harbor.dinauer.dev"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user