-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
65 lines (59 loc) · 1.95 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
pipeline {
agent any
parameters {
choice(name: 'DOCKER_IMAGE_INPUT', choices: [
'techeunimart/buyerapp.bullmq',
'techeunimart/buyerapp.elastic',
'techeunimart/buyerapp.kafka',
'techeunimart/buyerapp.onsearch',
'techeunimart/buyerapp.redis',
'techeunimart/buyerapp.schedular',
'techeunimart/sellerapp.bullmq',
'techeunimart/sellerapp.kafka',
'techeunimart/sellerapp.schedular'
], description: 'Docker repo where the image needs to be pushed')
choice(name: 'DOCKER_FILE_INPUT', choices: [
'Dockerfile.BuyerApp.bullmq',
'Dockerfile.BuyerApp.elastic',
'Dockerfile.BuyerApp.kafka',
'Dockerfile.BuyerApp.onsearch',
'Dockerfile.BuyerApp.redis',
'Dockerfile.BuyerApp.schedular',
'Dockerfile.SellerApp.bullmq',
'Dockerfile.SellerApp.kafka',
'Dockerfile.SellerApp.schedular'
], description: 'Docker file for building the image')
}
environment {
DOCKER_IMAGE = "${params.DOCKER_IMAGE_INPUT}"
DOCKER_FILE = "${params.DOCKER_FILE_INPUT}"
}
stages {
stage('Build Docker Image') {
steps {
script {
// Build Docker image
dockerImage = docker.build("${DOCKER_IMAGE}", "-f ${DOCKER_FILE} .")
}
}
}
stage('Push Docker Image') {
steps {
script {
// Push Docker image to Docker Hub
docker.withRegistry('https://registry.hub.docker.com', 'docker') {
dockerImage.push()
}
}
}
}
}
post {
success {
echo 'Pipeline successfully completed!'
}
failure {
echo 'Pipeline failed!'
}
}
}