forked from CeeyIT-Solutions/JavaWeb3
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile
More file actions
47 lines (42 loc) · 1.16 KB
/
Jenkinsfile
File metadata and controls
47 lines (42 loc) · 1.16 KB
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
45
46
47
pipeline {
agent any
environment {
IMAGE_NAME = 'wbrymo/java-webappcal'
}
stages {
stage('Clone Repo') {
steps {
sh '''
echo "🧹 Cleaning up existing folder if any..."
rm -rf JavaWeb3 || echo "Nothing to delete"
echo "📥 Cloning repository..."
git clone https://github.com/wbrymo/JavaWeb3.git JavaWeb3
'''
}
}
stage('Build Docker Image') {
steps {
dir('JavaWeb3') {
script {
def app = docker.build("${IMAGE_NAME}")
}
}
}
}
stage('Push to Docker Hub') {
steps {
script {
docker.withRegistry('https://index.docker.io/v1/', 'dockerhub-creds') {
docker.image("${IMAGE_NAME}").push('latest')
}
}
}
}
}
post {
always {
echo "🧼 Cleaning up Jenkins workspace..."
cleanWs()
}
}
}