-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
41 lines (36 loc) · 1.19 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pipeline {
agent any
options {
disableConcurrentBuilds()
ansiColor('xterm')
}
stages {
stage('Checkout'){
steps {
checkout scm
}
}
stage('Dockerhub login') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub', usernameVariable: 'DOCKERHUB_CREDENTIALS_USR', passwordVariable: 'DOCKERHUB_CREDENTIALS_PSW')]) {
sh 'docker login -u $DOCKERHUB_CREDENTIALS_USR -p "$DOCKERHUB_CREDENTIALS_PSW"'
}
}
}
stage('Build and push Docker Image') {
steps {
sh '''
BUILDER=`docker buildx create --use`
docker buildx build --platform linux/amd64,linux/arm64 -t nbr23/calibre_webui:latest -t nbr23/calibre_webui:`git rev-parse --short HEAD` --push .
docker buildx rm $BUILDER
'''
}
}
stage('Sync github repos') {
when { branch 'master' }
steps {
syncRemoteBranch('git@github.com:nbr23/calibre_webui.git', 'master')
}
}
}
}