Files
django-core-base/deployments/Jenkinsfile
2026-04-11 14:24:23 +02:00

40 lines
1.2 KiB
Groovy

pipeline {
agent any
environment {
// Valores por defecto para evitar errores
CONTAINER_NAME = "django_app_dev"
PORT = "8000"
DEBUG_MODE = "1"
}
stages {
stage('Configurar Entorno') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo "--- CONFIGURANDO MODO PRODUCCIÓN (MASTER) ---"
CONTAINER_NAME = "django_app_master"
PORT = "8001"
DEBUG_MODE = "0"
} else if (env.BRANCH_NAME == 'dev') {
echo "--- CONFIGURANDO MODO DESARROLLO (DEV) ---"
CONTAINER_NAME = "django_app_dev"
PORT = "8000"
DEBUG_MODE = "1"
}
}
}
}
stage('Despliegue') {
when {
anyOf { branch 'dev'; branch 'master' }
}
steps {
// Usamos las variables que configuramos arriba
sh "docker compose -f deployments/docker-compose.yml up -d --build"
}
}
}
}