added jenkins deployment

This commit is contained in:
2025-12-10 15:01:19 -05:00
parent 0f32c925f5
commit 1518608556

34
Jenkinsfile vendored
View File

@@ -31,6 +31,40 @@ pipeline {
} }
} }
stage('Deploy') {
steps {
echo 'Stopping and removing old containers...'
// 1. Stop and remove the old running containers (if they exist)
// The || true prevents the build from failing if the container doesn't exist yet
sh "docker stop ${VUE_CONTAINER_NAME} || true"
sh "docker rm ${VUE_CONTAINER_NAME} || true"
sh "docker stop ${FLASK_CONTAINER_NAME} || true"
sh "docker rm ${FLASK_CONTAINER_NAME} || true"
echo 'Starting new containers...'
// 2. Start the newly built images
// You must customize the ports (-p) and environment variables (-e) as needed
sh """
docker run -d \\
--name ${VUE_CONTAINER_NAME} \\
-p 443:443 \\
${VUE_IMAGE}
"""
sh """
docker run -d \\
--name ${FLASK_CONTAINER_NAME} \\
-p 5000:5000 \\
${FLASK_IMAGE}
"""
echo 'Deployment complete!'
}
}
}
stage('Cleanup') { stage('Cleanup') {
steps { steps {
// Optional: Stop old containers and run the new ones // Optional: Stop old containers and run the new ones