Fix Jenkinsfile

This commit is contained in:
2026-01-07 16:42:12 +01:00
parent 4a12b1a17a
commit c508c69e85

13
Jenkinsfile vendored
View File

@@ -1,24 +1,22 @@
pipeline {
agent any
environment {
IMAGE_NAME = "astro-portfolio"
CONTAINER_NAME = "portfolio"
DOCKER_NETWORK = "reverse-proxy"
DOCKER_HOST = "unix:///var/run/docker.sock"
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Docker Build') {
steps {
sh "docker build -t ${IMAGE_NAME} ."
}
}
stage('Deploy') {
steps {
sh "docker stop ${CONTAINER_NAME} || true"
@@ -26,15 +24,14 @@ pipeline {
sh "docker run -d --name ${CONTAINER_NAME} --network ${DOCKER_NETWORK} ${IMAGE_NAME}"
}
}
stage('Cleanup') {
steps {
sh "docker image prune -f"
}
}
}
post {
success { echo "Le site est en ligne !" }
failure { echo "Le déploiement a échoué." }
success { echo "Success !" }
failure { echo "Failed." }
}
}