-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
27 lines (26 loc) · 1.14 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
pipeline {
environment {
registry = 'hub.lshallo.eu/ploing'
}
agent any
stages {
stage('Cloning git') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CleanBeforeCheckout', deleteUntrackedNestedRepositories: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'github', url: 'https://github.com/LsHallo/ploing.git']]])
}
}
stage('Build image and push to docker hub') {
steps{
script {
withCredentials([usernamePassword(credentialsId: 'lshalloDockerHub', passwordVariable: 'password', usernameVariable: 'username')]) {
sh('docker login --username $username --password $password hub.lshallo.eu')
}
sh('docker buildx rm ploingbuilder || true')
sh('docker buildx create --name ploingbuilder --use')
sh("docker buildx build --tag $registry:latest --platform=linux/amd64 --push .")
sh('docker buildx rm ploingbuilder || true')
}
}
}
}
}