added jenkins deployment

This commit is contained in:
2025-12-10 15:20:34 -05:00
parent 80314380cc
commit 9740db54f7

10
Jenkinsfile vendored
View File

@@ -37,8 +37,6 @@ pipeline {
stage('Deploy') { stage('Deploy') {
steps { steps {
echo 'Stopping and removing old containers...' 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 stop ${VUE_CONTAINER_NAME} || true"
sh "docker rm ${VUE_CONTAINER_NAME} || true" sh "docker rm ${VUE_CONTAINER_NAME} || true"
sh "docker stop ${FLASK_CONTAINER_NAME} || true" sh "docker stop ${FLASK_CONTAINER_NAME} || true"
@@ -49,14 +47,12 @@ pipeline {
sh "docker network create ${NETWORK_NAME}" sh "docker network create ${NETWORK_NAME}"
echo "Starting new containers named ${VUE_CONTAINER_NAME} and ${FLASK_CONTAINER_NAME}... from images ${FRONTEND_IMAGE} and ${BACKEND_IMAGE}" echo "Starting new containers"
// 2. Start the newly built images
// You must customize the ports (-p) and environment variables (-e) as needed
sh """ sh """
docker run -d \\ docker run -d \\
--name ${VUE_CONTAINER_NAME} \\ --name ${VUE_CONTAINER_NAME} \\
--network ${NETWORK_NAME}" \\ --network ${NETWORK_NAME} \\
-p 443:443 \\ -p 443:443 \\
${FRONTEND_IMAGE} ${FRONTEND_IMAGE}
""" """
@@ -64,7 +60,7 @@ pipeline {
sh """ sh """
docker run -d \\ docker run -d \\
--name ${FLASK_CONTAINER_NAME} \\ --name ${FLASK_CONTAINER_NAME} \\
--network ${NETWORK_NAME}" \\ --network ${NETWORK_NAME} \\
${BACKEND_IMAGE} ${BACKEND_IMAGE}
""" """