-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathJenkinsfile-dev
More file actions
58 lines (49 loc) · 1.13 KB
/
Copy pathJenkinsfile-dev
File metadata and controls
58 lines (49 loc) · 1.13 KB
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
pipeline {
agent any
environment {
IMAGE_NAME = "react-ecommerce-dev"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Setup') {
steps {
sh 'npm install'
}
}
stage('Build') {
steps {
sh 'npm run build'
}
}
stage('Docker Build') {
steps {
sh 'docker build -t $IMAGE_NAME .'
}
}
stage('Run Docker') {
steps {
sh 'docker run -d -p 3002:80 --name ${IMAGE_NAME}-container $IMAGE_NAME'
}
}
stage('Smoke Test') {
steps {
sh 'curl -f http://localhost:3002 || exit 1'
}
}
stage('Archive Artifacts') {
steps {
archiveArtifacts artifacts: '**/dist/**', fingerprint: true
}
}
}
post {
always {
sh 'docker ps -q | xargs -r docker stop'
sh 'docker ps -aq | xargs -r docker rm'
}
}
}