-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
46 lines (43 loc) · 985 Bytes
/
Jenkinsfile
File metadata and controls
46 lines (43 loc) · 985 Bytes
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
pipeline
{
agent any
environment {
DOCKERHUB_CREDENTIALS=credentials('dockerhub')
}
stages
{
stage('fetch code')
{
steps
{
git branch: 'main',url: 'https://github.com/TESLAOPUnix/react-circleci.git'
}
}
stage('install')
{
steps
{
sh 'npm install'
}
}
stage('docker login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('build image') {
steps {
script {
def tag = env.BUILD_NUMBER
sh "docker build -t teslaopunix/react-ci-cd:$tag ."
sh "docker push teslaopunix/react-ci-cd:$tag"
}
}
}
}
post {
always {
sh 'docker logout'
}
}
}