Files
pagasis/docker-compose.yml
T

68 lines
1.6 KiB
YAML
Raw Normal View History

2025-10-15 23:45:32 -06:00
services:
# PostgreSQL Database
db:
image: postgres:15-alpine
2025-10-21 04:14:58 -06:00
env_file:
- .env.production
2025-10-15 23:45:32 -06:00
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- app-network
2025-10-21 04:14:58 -06:00
# NO exponer puertos al host - solo accesible internamente
2025-10-15 23:45:32 -06:00
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mac_user -d mac_attendance"]
interval: 10s
timeout: 5s
retries: 5
# Backend Django
backend:
build:
context: .
dockerfile: docker/Dockerfile.backend
command: >
sh -c "python manage.py migrate &&
python init_db.py &&
2025-10-15 23:45:32 -06:00
python manage.py collectstatic --noinput &&
2025-10-21 04:14:58 -06:00
gunicorn --bind 0.0.0.0:8000 --workers 3 --timeout 300 mac_attendance.wsgi:application"
2025-10-15 23:45:32 -06:00
volumes:
- ./backend:/app
- static_volume:/app/staticfiles
- media_volume:/app/media
2025-10-21 04:14:58 -06:00
env_file:
- .env.production
2025-10-15 23:45:32 -06:00
networks:
- app-network
depends_on:
db:
condition: service_healthy
expose:
- "8000"
# Frontend React + Nginx
nginx:
build:
context: .
dockerfile: docker/Dockerfile.frontend
ports:
2025-10-21 04:14:58 -06:00
- "443:443" # HTTPS (SSL/TLS) - ÚNICO puerto expuesto al host
2025-10-15 23:45:32 -06:00
volumes:
- ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
2025-10-21 04:14:58 -06:00
- ./docker/ssl:/etc/nginx/ssl:ro # Certificados SSL (solo lectura)
2025-10-15 23:45:32 -06:00
- static_volume:/app/staticfiles
- media_volume:/app/media
depends_on:
- backend
networks:
- app-network
networks:
app-network:
2025-10-21 04:14:58 -06:00
# Red interna para comunicación entre contenedores
# Solo nginx expone puerto 443 al host
2025-10-15 23:45:32 -06:00
volumes:
static_volume:
media_volume:
postgres_data: