version: '3.8' services: # PostgreSQL Database db: image: postgres:15-alpine container_name: nairobi_db environment: POSTGRES_USER: nairobiuser POSTGRES_PASSWORD: nairobipass POSTGRES_DB: nairobi_info volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U nairobiuser"] interval: 10s timeout: 5s retries: 5 # Redis Cache redis: image: redis:7-alpine container_name: nairobi_redis ports: - "6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # Main Application app: build: . container_name: nairobi_app ports: - "8000:8000" environment: - DATABASE_URL=postgresql://nairobiuser:nairobipass@db:5432/nairobi_info - REDIS_URL=redis://redis:6379/0 - ENVIRONMENT=production - DEBUG=False depends_on: db: condition: service_healthy redis: condition: service_healthy volumes: - ./logs:/app/logs - ./.env:/app/.env restart: unless-stopped # Nginx Reverse Proxy (optional) nginx: image: nginx:alpine container_name: nairobi_nginx ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro depends_on: - app restart: unless-stopped volumes: postgres_data: redis_data: