Merge pull request 'Удаление старых образов перед деплоем' (#32) from feature/task-30-docker into master
Hedgehog_server_CD/ServerMonitorBot/pipeline/head There was a failure building this commit Details

Reviewed-on: #32
pull/35/head
L_DelOff 2023-11-22 18:48:16 +03:00
commit 5b0decff19
2 changed files with 11 additions and 8 deletions

View File

@ -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'

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.3</version>
<version>3.1.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ru.ldeloff</groupId>