-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
45 lines (44 loc) · 1.46 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
pipeline {
agent any
environment {
DOCKERHUB_CREDENTIALS = credentials('dockerhub-token')
ENV_FILE_ID = '342cbbf9-e0a8-4807-b11c-1d9ec45b0860'
IMAGE_VERSION = '0.1'
}
stages {
stage('Provision ENV File') {
steps {
sh 'echo "Provisioning .env.production.local file..."'
configFileProvider([configFile(fileId: "${ENV_FILE_ID}", targetLocation: '.env.production.local')]) {
sh 'echo .env.production.local file provisioned'
}
}
}
stage('Build docker images') {
steps {
sh 'echo "Building docker image..."'
sh "docker build -t neenus007/xlsx2csv-client:${IMAGE_VERSION}.${BUILD_NUMBER} -f Dockerfile ."
sh 'docker build -t neenus007/xlsx2csv-client:latest -f Dockerfile .'
}
}
stage('Login to DockerHub') {
steps {
sh 'echo "Logging in to DockerHub..."'
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push images to DockerHub') {
steps {
sh 'echo "Pushing to DockerHub..."'
sh "docker push neenus007/xlsx2csv-client:${IMAGE_VERSION}.${BUILD_NUMBER}"
sh 'docker push neenus007/xlsx2csv-client:latest'
}
}
stage('Logout from DockerHub') {
steps {
sh 'echo "Logging out from DockerHub..."'
sh 'docker logout'
}
}
}
}