fix deployments
This commit is contained in:
17
deployments/Jenkinsfile
vendored
17
deployments/Jenkinsfile
vendored
@@ -2,7 +2,7 @@ pipeline {
|
|||||||
agent any
|
agent any
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
// Valores por defecto para evitar errores
|
// Valores iniciales por seguridad
|
||||||
CONTAINER_NAME = "django_app_dev"
|
CONTAINER_NAME = "django_app_dev"
|
||||||
PORT = "8000"
|
PORT = "8000"
|
||||||
DEBUG_MODE = "1"
|
DEBUG_MODE = "1"
|
||||||
@@ -14,14 +14,14 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
if (env.BRANCH_NAME == 'master') {
|
if (env.BRANCH_NAME == 'master') {
|
||||||
echo "--- CONFIGURANDO MODO PRODUCCIÓN (MASTER) ---"
|
echo "--- CONFIGURANDO MODO PRODUCCIÓN (MASTER) ---"
|
||||||
CONTAINER_NAME = "django_app_master"
|
env.CONTAINER_NAME = "django_app_master"
|
||||||
PORT = "8001"
|
env.PORT = "8001"
|
||||||
DEBUG_MODE = "0"
|
env.DEBUG_MODE = "0"
|
||||||
} else if (env.BRANCH_NAME == 'dev') {
|
} else if (env.BRANCH_NAME == 'dev') {
|
||||||
echo "--- CONFIGURANDO MODO DESARROLLO (DEV) ---"
|
echo "--- CONFIGURANDO MODO DESARROLLO (DEV) ---"
|
||||||
CONTAINER_NAME = "django_app_dev"
|
env.CONTAINER_NAME = "django_app_dev"
|
||||||
PORT = "8000"
|
env.PORT = "8000"
|
||||||
DEBUG_MODE = "1"
|
env.DEBUG_MODE = "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,8 @@ pipeline {
|
|||||||
anyOf { branch 'dev'; branch 'master' }
|
anyOf { branch 'dev'; branch 'master' }
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
// Usamos las variables que configuramos arriba
|
echo "Desplegando contenedor: ${env.CONTAINER_NAME} en puerto: ${env.PORT}"
|
||||||
|
// Ahora Docker Compose sí recibirá los valores correctamente
|
||||||
sh "docker compose -f deployments/docker-compose.yml up -d --build"
|
sh "docker compose -f deployments/docker-compose.yml up -d --build"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,3 +12,8 @@ services:
|
|||||||
- frontend
|
- frontend
|
||||||
ports:
|
ports:
|
||||||
- "${PORT}:8000"
|
- "${PORT}:8000"
|
||||||
|
|
||||||
|
# --- ESTA ES LA PARTE QUE FALTABA ---
|
||||||
|
networks:
|
||||||
|
frontend:
|
||||||
|
driver: bridge
|
||||||
Reference in New Issue
Block a user