added jenkins deployment

This commit is contained in:
2025-12-10 15:16:30 -05:00
parent c9bcee437b
commit ad5a43310f

10
Jenkinsfile vendored
View File

@@ -7,6 +7,7 @@ pipeline {
BACKEND_IMAGE = "chore-app-frontend:${env.BUILD_ID}"
VUE_CONTAINER_NAME = "chore-app-frontend"
FLASK_CONTAINER_NAME = "chore-app-backend"
NETWORK_NAME = "chore-app-net"
}
stages {
@@ -35,8 +36,11 @@ pipeline {
stage('Deploy') {
steps {
echo 'Stopping and removing old containers...'
echo 'Cleaning up and creating network...'
sh "docker network rm -f ${NETWORK_NAME} || true"
sh "docker network create ${NETWORK_NAME}"
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"
@@ -51,7 +55,7 @@ pipeline {
sh """
docker run -d \\
--name ${VUE_CONTAINER_NAME} \\
--network chore-app-net \\
--network ${NETWORK_NAME}" \\
-p 443:443 \\
${FRONTEND_IMAGE}
"""
@@ -59,7 +63,7 @@ pipeline {
sh """
docker run -d \\
--name ${FLASK_CONTAINER_NAME} \\
--network chore-app-net \\
--network ${NETWORK_NAME}" \\
${BACKEND_IMAGE}
"""