From 15186085568d5749c25be53a020af29c433daf86 Mon Sep 17 00:00:00 2001 From: Ryan Kegel Date: Wed, 10 Dec 2025 15:01:19 -0500 Subject: [PATCH] added jenkins deployment --- Jenkinsfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index bf819de..583c17e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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') { steps { // Optional: Stop old containers and run the new ones