-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
35 lines (35 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
28
29
30
31
32
33
34
35
// Expected parameters:
// - image_tag: Tag that will be used for the new image.
// - build_image: Base image that the image being built extends.
pipeline {
agent any
environment {
image_repo = "concordium/dapp-piggybank"
image_name = "${image_repo}:${image_tag}"
}
stages {
stage('dockerhub-login') {
environment {
// Defines 'CRED_USR' and 'CRED_PSW'
// (see 'https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#handling-credentials').
CRED = credentials('jenkins-dockerhub')
}
steps {
sh 'docker login --username "${CRED_USR}" --password "${CRED_PSW}"'
}
}
stage('build-push') {
steps {
sh '''\
docker build \
--build-arg build_image="${build_image}" \
--label build_image="${build_image}" \
--tag="${image_name}" \
--pull \
.
docker push "${image_name}"
'''.stripIndent()
}
}
}
}