forked from val-lop20/Pagina-de-Asistencia-MAC
86 lines
2.2 KiB
YAML
86 lines
2.2 KiB
YAML
|
|
# Docker Compose para Entorno de Desarrollo
|
||
|
|
# Incluye todas las herramientas de desarrollo y testing
|
||
|
|
|
||
|
|
services:
|
||
|
|
# PostgreSQL Database (Desarrollo)
|
||
|
|
db:
|
||
|
|
image: postgres:15-alpine
|
||
|
|
environment:
|
||
|
|
- POSTGRES_DB=mac_attendance
|
||
|
|
- POSTGRES_USER=mac_user
|
||
|
|
- POSTGRES_PASSWORD=mac_password_2024_secure
|
||
|
|
volumes:
|
||
|
|
- postgres_data_dev:/var/lib/postgresql/data
|
||
|
|
networks:
|
||
|
|
- app-network
|
||
|
|
ports:
|
||
|
|
- "5432:5432" # Expuesto para acceso desde host
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U mac_user -d mac_attendance"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
# Backend Django (Desarrollo)
|
||
|
|
backend:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: docker/Dockerfile.backend.dev
|
||
|
|
command: >
|
||
|
|
sh -c "python manage.py migrate &&
|
||
|
|
python manage.py collectstatic --noinput &&
|
||
|
|
python manage.py runserver 0.0.0.0:8000"
|
||
|
|
volumes:
|
||
|
|
- ./backend:/app
|
||
|
|
- static_volume:/app/staticfiles
|
||
|
|
- media_volume:/app/media
|
||
|
|
environment:
|
||
|
|
- DEBUG=True
|
||
|
|
- SECRET_KEY=django-insecure-dev-key-change-in-production-12345
|
||
|
|
- ALLOWED_HOSTS=localhost,127.0.0.1,nginx,backend
|
||
|
|
- RATELIMIT_ENABLE=False
|
||
|
|
- SECURE_SSL_REDIRECT=False
|
||
|
|
- SESSION_COOKIE_SECURE=False
|
||
|
|
- CSRF_COOKIE_SECURE=False
|
||
|
|
- CORS_ALLOWED_ORIGINS=http://localhost,http://127.0.0.1,http://localhost:80
|
||
|
|
- DB_ENGINE=postgresql
|
||
|
|
- DB_NAME=mac_attendance
|
||
|
|
- DB_USER=mac_user
|
||
|
|
- DB_PASSWORD=mac_password_2024_secure
|
||
|
|
- DB_HOST=db
|
||
|
|
- DB_PORT=5432
|
||
|
|
networks:
|
||
|
|
- app-network
|
||
|
|
depends_on:
|
||
|
|
db:
|
||
|
|
condition: service_healthy
|
||
|
|
expose:
|
||
|
|
- "8000"
|
||
|
|
stdin_open: true # Para ipdb y debugging interactivo
|
||
|
|
tty: true
|
||
|
|
|
||
|
|
# Frontend React + Nginx
|
||
|
|
nginx:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: docker/Dockerfile.frontend
|
||
|
|
ports:
|
||
|
|
- "80:80"
|
||
|
|
volumes:
|
||
|
|
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
|
||
|
|
- static_volume:/app/staticfiles
|
||
|
|
- media_volume:/app/media
|
||
|
|
depends_on:
|
||
|
|
- backend
|
||
|
|
networks:
|
||
|
|
- app-network
|
||
|
|
|
||
|
|
networks:
|
||
|
|
app-network:
|
||
|
|
driver: bridge
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
static_volume:
|
||
|
|
media_volume:
|
||
|
|
postgres_data_dev:
|