pipeline { agent { node { label "agent_smith" docker { image "docker:stable" } } } environment { REGISTRY_URL = "https://proxy.docker.dataekb.ru/harbor/projects/3/repositories" IMAGE_NAME = "open_sesam" IMAGE_TAG = "latest" } stages { stage("Build Docker Image") { steps { script { docker.build("${IMAGE_NAME}:${IMAGE_TAG}") } } } stage('Push to Harbor') { steps { script { docker.withRegistry("{REGISTRY_URL}", "harbor-credentials") { docker.image("${IMAGE_NAME}:${IMAGE_TAG}").push() } } } } stage("Deploy") { steps { script { sh ''' docker-compose pull docker-compose up -d ''' } } } } post { failure { echo "[ERROR] Build failure" } success { echo "[OK] Build success" } } } // Old_version // pipeline { // agent { label 'agent_smith' } // // stages { // stage('Stop and Remove Existing Container') { // steps { // sh ''' // docker stop open_sesam || true // docker rm open_sesam || true // docker-compose down || true // ''' // } // } // // stage('Build and Run Container') { // steps { // sh ''' // docker-compose up --build -d // ''' // } // } // } // }