Files
portfolio/Jenkinsfile
Lucas 9f7c4dbb2e
All checks were successful
Portfolio/pipeline/head This commit looks good
Switch to jenkins multipipeline
2026-01-08 11:48:07 +01:00

33 lines
810 B
Groovy

pipeline {
agent any
environment {
DOCKER_HOST = "unix:///var/run/docker.sock"
}
stages {
stage('Docker Build') {
steps {
echo "Build new docker image from ${env.BRANCH_NAME}..."
sh "docker build -t portfolio:${env.BRANCH_NAME} ."
}
}
stage('Deploy') {
// Deploy only master branch
when {
branch 'master'
}
steps {
echo "Deploy new portfolio version..."
sh "docker compose up -d"
}
}
}
post {
always {
echo "Clean unused image..."
sh "docker image prune -f"
}
success { echo "Success !" }
failure { echo "Failed." }
}
}