-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
44 lines (42 loc) · 1021 Bytes
/
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
42
43
44
#!/usr/bin/env groovy
/**
* Sample Jenkinsfile for Jenkins2 Pipeline
* from https://github.com/saidsef
* by saidsef@gmail.com
*/
pipeline {
agent any
options {
disableConcurrentBuilds()
timestamps()
}
environment {
TAG = "${new Date().format("Y.M")}"
}
stages {
stage("Checkout") {
steps {
deleteDir()
checkout scm
}
}
stage("Build and push container") {
steps {
script {
def app = docker.build("docker.io/saidsef/alpine-jenkins-dockerfile:${env.BUILD_NUMBER}", ".")
/**
* In order to configure the registry credentials, go the Jenkins Manager Credentials page.
* Add a new username/password entry and enter your registry login and password.
*/
app.withRegistry("https://registry.hub.docker.com", "dockerhub")
app.push("docker.io/saidsef/alpine-jenkins-dockerfile:${env.BUILD_NUMBER}")
}
}
}
}
post {
success {
deleteDir()
}
}
}