Jenkinsfile 1.18 KiB
node{
def app
def registryProject='http://127.0.0.1:8083'
def image="${registryProject}:version-${env.BUILD_ID}"
stage('Clone') {
checkout scm
}
stage('Scan hadolint'){
sh 'docker run --rm -i hadolint/hadolint < Dockerfile > rapportHadolint || true'
}
stage('Build image') {
app = docker.build ("debian:buster")
}
stage('Test image') {
docker.image('debian:buster').withRun() { c ->
sh 'docker ps'
}
}
stage('Scan Dockle'){
sh 'dockle debian:buster > rapportDockle'
}
stage('Scan Clair'){
sh '''
wget -qO clair-scanner https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 && chmod +x clair-scanner
./clair-scanner --ip="http://172.20.0.6:6060" --clair="http://172.20.0.6:6060" debian:buster || exit 0
'''
}
stage('Push on repo nexus'){
docker.withRegistry(registryProject,'reg2'){
img.push 'latest'
img.push
}
}
}