-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
43 lines (31 loc) · 1.23 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
pipeline {
agent any
environment {
GITHUB_USERNAME_TOKEN=credentials('GITHUB_USERNAME_TOKEN')
}
stages {
stage('Cloning our Git') {
steps {
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/RajithaFernando/evote-backend-userservice']])
sh 'whoami'
}
}
stage('Build Docker Image') {
steps {
script {
sh 'docker build . --file Dockerfile --tag rajithafernando/evote-backend-userservice'
}
}
}
stage('Dockerhub push image') {
steps {
script {
withCredentials([string(credentialsId: 'DOCKERHUB_PASSWORD', variable: 'DOCKERHUB_PASSWORD')]) {
sh 'docker login -u rajithafernando -p ${DOCKERHUB_PASSWORD}'
sh 'docker push rajithafernando/evote-backend-userservice'
}
}
}
}
}
}