Files
django-core-base/deployments/Jenkinsfile
2026-04-11 15:03:38 +02:00

40 lines
1.2 KiB
Groovy

pipeline {
agent any
environment {
// Dejamos las variables vacías aquí para que el script las rellene
CONTAINER_NAME = ""
PORT = ""
DEBUG_MODE = ""
}
stages {
stage('Configurar Entorno') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo "--- ASIGNANDO VALORES DE PRODUCCIÓN ---"
env.CONTAINER_NAME = "django_app_master"
env.PORT = "8001"
env.DEBUG_MODE = "0"
} else {
echo "--- ASIGNANDO VALORES DE DESARROLLO ---"
env.CONTAINER_NAME = "django_app_dev"
env.PORT = "8000"
env.DEBUG_MODE = "1"
}
}
}
}
stage('Despliegue') {
when {
anyOf { branch 'dev'; branch 'master' }
}
steps {
echo "EJECUTANDO DOCKER: ${env.CONTAINER_NAME} en el puerto ${env.PORT}"
sh "docker compose -f deployments/docker-compose.yml up -d --build"
}
}
}
}