-
Notifications
You must be signed in to change notification settings - Fork 0
/
Backup_Jenkinsfile
69 lines (61 loc) · 1.64 KB
/
Backup_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
66
67
68
69
pipeline {
// agent {
// docker {
// image 'node:16-alpine'
// label 'docker'
// args '-v /var/run/docker.sock:/var/run/docker.sock'
// }
// }
agent any
environment {
// DOCKER_TEST_IMAGE = 'saxenapawan800/docker-react-app-tests'
DOCKER_PROD_IMAGE = 'saxenapawan800/docker-react-app'
}
stages {
stage('Checkout code') {
steps {
git branch: 'master', url: 'https://github.com/pawan-saxena/docker-react-app'
}
}
// stage("Install Dependencies") {
// steps {
// script {
// sh "npm run install"
// }
// }
// }
// stage('Build Docker Tests Image') {
// steps {
// script {
// sh 'docker build -f Dockerfile.dev -t $DOCKER_TEST_IMAGE .'
// }
// }
// }
// stage('Run Tests') {
// steps {
// script {
// sh 'docker run -e CI=true $DOCKER_TEST_IMAGE npm run test'
// }
// }
// }
stage('Build Docker Nginx Image') {
steps {
script {
sh 'docker build -t $DOCKER_PROD_IMAGE .'
}
}
}
stage('Start Application') {
steps {
script {
sh 'docker run -d -p 80:80 $DOCKER_PROD_IMAGE'
}
}
}
}
post {
always {
sh 'docker system prune -f'
}
}
}