diff --git a/Jenkinsfile b/Jenkinsfile index 1df6e8e..eaeee3c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,59 +1,55 @@ pipeline { - agent any + agent none + options { + + disableConcurrentBuilds(abortPrevious: true) + + buildDiscarder(logRotator(numToKeepStr: '1')) + } + stages { - - stage('Build Docker Image') { - - steps { - - script { - - def imageName = "python-jenkins-project:${BUILD_NUMBER}" - - sh "DOCKER_BUILDKIT=0 docker build --no-cache -t ${imageName} ." - - env.IMAGE_NAME = imageName - - } - + + + stage('docker compose build') { + + agent { + + label "xochi" + } - } - - stage('Deploy Docker Container') { - steps { - script { + dir('.') { - sh "docker stop python-jenkins-container || true" + sh 'docker compose build' + + } - sh "docker rm python-jenkins-container || true" + } - sh "docker run -d -p 5555:80 --name python-jenkins-container ${env.IMAGE_NAME}" + } - } + stage('docker compose push') { + agent { + + label "xochi" + } - } - - stage('Verify Deployment') { - steps { - script { + dir('.') { - sh "curl http://38.110.1.139:5555" - - } + sh 'docker compose push' + + } } - } - - } - -} + } + +}}