diff --git a/Jenkinsfile1 b/Jenkinsfile1 new file mode 100644 index 0000000..6e08031 --- /dev/null +++ b/Jenkinsfile1 @@ -0,0 +1,69 @@ +pipeline { + agent any + + tools { + jdk 'jdk17' + nodejs 'node20' + } + + environment { + SCANNER_HOME= tool 'sonar-scanner' + } + stages { + stage('Git Checkout') { + steps { + git branch: 'main', url: 'https://github.com/praks7v/fullstack-bank.git' + } + } + + stage('OWASP FS Scan') { + steps { + dependencyCheck additionalArguments: '--scan ./app/backend --disableYarnAudit --disableNodeAudit' , odcInstallation: 'DC' + dependencyCheckPublisher pattern: '**/dependency-check-report.xml' + } + } + + stage('Trivy FS Scan') { + steps { + sh "trivy fs ." + } + } + + stage('SonarQube Analysis') { + steps { + withSonarQubeEnv('sonar') { + sh "$SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Bank -Dsonar.projectKey=Bank" + + } + } + } + + stage('Install Dependency') { + steps { + sh "npm install" + } + } + + stage('Backend') { + steps { + dir('app/backend') { + sh "npm install" + } + } + } + + stage('Frontend') { + steps { + dir('app/frontend'){ + sh "npm install" + } + } + } + + stage("Deploy to Container"){ + steps { + sh "npm run compose:up -d" + } + } + } +} diff --git a/package.json b/package.json index e3bdd0e..f0c4410 100644 --- a/package.json +++ b/package.json @@ -8,9 +8,9 @@ "test:e2e:open": "cypress open --browser electron --e2e", "test:integration": "cd app/backend && npm i && npm run test:coverage", "test": "npm run test:e2e && npm run test:integration", - "compose:up": "cd app && docker-compose up -d", - "compose:up:build": "cd app && docker-compose up -d --build", - "compose:down": "cd app && docker-compose down --remove-orphans", + "compose:up": "cd app && docker compose up -d", + "compose:up:build": "cd app && docker compose up -d --build", + "compose:down": "cd app && docker compose down --remove-orphans", "postinstall": "cd app/backend && npm i && cd ../frontend && npm i" }, "author": "Raphael Martins",