-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
77 lines (73 loc) · 2.5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
77 lines (73 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
services:
db:
image: postgres:15-alpine
container_name: sgcub_db
restart: always
environment:
POSTGRES_DB: ${DB_NAME:-sgcub_db}
POSTGRES_USER: ${DB_USER:-sgcub_user}
POSTGRES_PASSWORD: "${DB_PASSWORD:?Error: Falla de seguridad. Debes definir DB_PASSWORD en el archivo .env}"
ports:
- "127.0.0.1:5433:5432" #Limitado a loopback para que no sea accesible desde fuera del host
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
backend:
build: ./Backend
container_name: sgcub_backend
# Aplica las migraciones y crea el administrador inicial (ADMIN_DNI / ADMIN_PASSWORD del .env) antes de arrancar
command: sh -c "python manage.py migrate && python manage.py create_initial_admin && python manage.py runserver 0.0.0.0:8000"
env_file:
- .env
volumes:
- ./Backend:/app
- /documentacion:/app/media
ports:
- "127.0.0.1:8000:8000"
environment:
DB_NAME: ${DB_NAME:-sgcub_db}
DB_USER: ${DB_USER:-sgcub_user}
DB_PASSWORD: "${DB_PASSWORD:?Error: Falla de seguridad. Debes definir DB_PASSWORD en el archivo .env}"
DB_HOST: ${DB_HOST:-db}
DB_PORT: ${DB_PORT:-5432}
depends_on:
db:
condition: service_healthy
qcluster:
build: ./Backend
container_name: sgcub_qcluster
command: python manage.py qcluster
restart: unless-stopped
env_file:
- .env
volumes:
- ./Backend:/app
environment:
DB_NAME: ${DB_NAME:-sgcub_db}
DB_USER: ${DB_USER:-sgcub_user}
DB_PASSWORD: "${DB_PASSWORD:?Error: Falla de seguridad. Debes definir DB_PASSWORD en el archivo .env}"
DB_HOST: ${DB_HOST:-db}
DB_PORT: ${DB_PORT:-5432}
depends_on:
db:
condition: service_healthy
backend:
condition: service_started
frontend:
build: ./Frontend/SGCUB
container_name: sgcub_frontend
command: sh -c "npm install && npm run dev -- --host" # Usamos install y no ci para evitar que se borre la caché de node_modules en cada reinicio, host vital para que Vite funcione correctamente en contenedores
volumes:
- ./Frontend/SGCUB:/app
- /app/node_modules # Evita sobreescribir los módulos de node
ports:
- "127.0.0.1:5173:5173"
environment:
- CHOKIDAR_USEPOLLING=true # Ayuda al hot-reload en Windows
- WATCHPACK_POLLING=true
volumes:
postgres_data: