From 2bca814b3fcf9ebbe16cbc9e26cbea8ceac6157b Mon Sep 17 00:00:00 2001 From: L_DelOff Date: Wed, 22 Nov 2023 18:45:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=81=D1=82=D0=B0=D1=80=D1=8B=D1=85=20=D0=BE=D0=B1?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=20=D0=B4=D0=B5=D0=BF=D0=BB=D0=BE=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile_CD | 17 ++++++++++------- pom.xml | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile_CD b/Jenkinsfile_CD index 8a49b26..99f0f38 100644 --- a/Jenkinsfile_CD +++ b/Jenkinsfile_CD @@ -30,12 +30,15 @@ pipeline { sh 'mvn -B -DskipTests -X clean package spring-boot:repackage' } } - stage('Prune images pre') { - steps { - sh """ - sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'docker image prune --all --force' - """ - } + stage('Stop container') { + sh """ + sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'cd ${PATH_TO_DEV_FOLDER} && docker compose down' + """ + } + stage('Remove old image') { + sh """ + sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'docker image rm -f ${IMAGE_NAME}:${IMAGE_VERSION} || true' + """ } stage('Deploy') { steps { @@ -52,7 +55,7 @@ pipeline { } } } - stage('Prune images post') { + stage('Remove useless images') { steps { sh """ sshpass -p ${SSH_PASS} ssh -o StrictHostKeyChecking=no ${SSH_USER}@${SSH_HOST} -p ${SSH_PORT} 'docker image prune --all --force' diff --git a/pom.xml b/pom.xml index 9ecb466..3f3a189 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 3.1.3 + 3.1.2 ru.ldeloff