Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
pipeline {
agent any

environment {
GIT_REPO = "https://github.com/NeuronAddict/vulnerable-apps.git" // URL du dépôt
IMAGE_NAME = "vulnerable-dvwa" // Nom de l'image Docker pour DVWA
IMAGE_TAG = "latest" // Tag de l'image
APP_DIR = "vulnerable-apps/dvwa" // Répertoire de l'application vulnérable (DVWA)
}

stages {
stage('Clone Repository') {
steps {
// Cette étape clone le dépôt GitHub
git "${GIT_REPO}"
}
}

stage('Build Docker Image') {
steps {
script {
// Cette étape construit l'image Docker pour l'application vulnérable (DVWA)
sh "cd ${APP_DIR} && docker build -t ${IMAGE_NAME}:${IMAGE_TAG} ."
}
}
}

stage('Scan Docker Image with Trivy') {
steps {
script {
// Cette étape scanne l'image construite avec Trivy pour détecter les vulnérabilités
sh "trivy image --format json -o trivy-report.json ${IMAGE_NAME}:${IMAGE_TAG}"

// Affiche le rapport généré par Trivy dans Jenkins
sh "cat trivy-report.json"
}
}
}
}

post {
always {
// Affiche un message après l'exécution du pipeline
echo "Analyse de sécurité terminée !"
}
}
}