-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
62 lines (62 loc) · 1.45 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
pipeline {
agent any {
tools {
nodejs 'node19'
}
environment {
SCANNER_HOME = tool 'scanner-scanner'
}
stages {
stage('Clean Workspace') {
steps {
cleanWs()
}
}
stage('Git Checkout') {
steps {
git branch: 'main', url: 'https://github.com/thisisrishabh22/lazy-learning.git'
}
}
stage('Quality Gate') {
steps {
script {
waitForQualityGate success: false, credentialsId: 'Sonar-token'
}
}
}
stage('Install Dependencies') {
steps {
sh 'npm install'
}
}
stage('OWASP File Security Scan') {
steps {
script {
dependencyCheck additionalArguments: '', odcInstallation: 'DP-Check'
}
}
}
stage('Trivy File System Scan') {
steps {
sh 'trivy fs .'
}
}
stage('Docker Build and Push') {
steps {
script {
withDockerRegistry(credentialsId: 'docker') {
sh 'docker build -t lazy-learning:latest .'
sh 'docker tag lazy-learning yourregistryname/swoc:latest'
sh 'docker push yourregistryname/swoc:latest'
}
}
}
}
stage('Deploy to Container') {
steps {
sh 'docker run -d --name Lazy-Learning -p 3000:80 yourregistryname/swoc:latest'
}
}
}
}
}