added jenkins deployment
This commit is contained in:
11
Jenkinsfile
vendored
11
Jenkinsfile
vendored
@@ -70,6 +70,17 @@ pipeline {
|
|||||||
|
|
||||||
stage('Cleanup') {
|
stage('Cleanup') {
|
||||||
steps {
|
steps {
|
||||||
|
echo 'Removing old/dangling Docker images...'
|
||||||
|
// Remove all images that are not associated with a container
|
||||||
|
// This targets the untagged images created by previous builds
|
||||||
|
sh 'docker image prune -f'
|
||||||
|
|
||||||
|
// OPTIONAL: Remove images older than a certain time (e.g., 24 hours)
|
||||||
|
// This is useful if you want to keep the most recent successful images
|
||||||
|
// for quick rollback, but remove others.
|
||||||
|
// sh 'docker image prune -a -f --filter "until=24h"'
|
||||||
|
|
||||||
|
echo 'Docker images pruned.'
|
||||||
// Optional: Stop old containers and run the new ones
|
// Optional: Stop old containers and run the new ones
|
||||||
// Note: In production, you would push to a registry (DockerHub) instead
|
// Note: In production, you would push to a registry (DockerHub) instead
|
||||||
sh "echo 'Build Complete. Images ready: ${FRONTEND_IMAGE} and ${BACKEND_IMAGE}'"
|
sh "echo 'Build Complete. Images ready: ${FRONTEND_IMAGE} and ${BACKEND_IMAGE}'"
|
||||||
|
|||||||
Reference in New Issue
Block a user