feat: integración final de Jenkins con inyección de .env segura
All checks were successful
DEPLOY_MULTI_BRACH/pipeline/head This commit looks good

This commit is contained in:
minguezsanzjuanjose
2026-04-14 21:30:19 +02:00
parent 9dd97b34f2
commit 039349b5b1
12 changed files with 186 additions and 89 deletions

View File

@@ -1,36 +1,42 @@
services:
db:
image: postgres:15
container_name: django_db_local
# Cargamos el archivo directamente
env_file:
- ../.env
container_name: ${DB_CONTAINER_NAME:-django_db_local}
restart: always
# Solo usamos el .env de esta carpeta
env_file: .env
environment:
# POSTGRES_DB espera estas variables exactas,
# así que las mapeamos a lo que tienes en tu .env
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
ports:
- "5432:5432"
- "${DATABASE_EXPOSE_PORT:-5432}:5432"
volumes:
- local_postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 5s
timeout: 5s
retries: 5
web:
build: .
container_name: django_app_dev
build:
context: ..
dockerfile: deployments/Dockerfile
container_name: ${APP_CONTAINER_NAME:-django_app_dev}
restart: always
volumes:
- ..:/app
# Cargamos el archivo directamente aquí también
env_file:
- ../.env
ports:
- "${PORT:-8000}:8000"
# Inyectamos el .env local al contenedor web
env_file: .env
environment:
- DB_HOST=db
- DB_PORT=5432
ports:
- "8000:8000"
depends_on:
- db
db:
condition: service_healthy
volumes:
local_postgres_data: