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