version: '3.8' services: # Main application app: build: context: . target: production ports: - "8500:8500" environment: - STREAMLIT_SERVER_PORT=8500 - STREAMLIT_SERVER_ADDRESS=0.0.0.0 - PYTHONPATH=/app volumes: - ./data:/app/data - ./models:/app/models - ./logs:/app/logs restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8500/_stcore/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s # GPU-enabled version (uncomment if you have GPU support) # app-gpu: # build: # context: . # target: gpu # ports: # - "8501:8500" # environment: # - STREAMLIT_SERVER_PORT=8500 # - STREAMLIT_SERVER_ADDRESS=0.0.0.0 # - PYTHONPATH=/app # - CUDA_VISIBLE_DEVICES=0 # volumes: # - ./data:/app/data # - ./models:/app/models # - ./logs:/app/logs # deploy: # resources: # reservations: # devices: # - driver: nvidia # count: 1 # capabilities: [gpu] # restart: unless-stopped # Jupyter notebook for development jupyter: build: context: . target: development ports: - "8888:8888" environment: - JUPYTER_TOKEN=advanced-ai-research-2026 - JUPYTER_ENABLE_LAB=yes volumes: - .:/app - ./notebooks:/app/notebooks command: ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--NotebookApp.token=advanced-ai-research-2026"] restart: unless-stopped profiles: - development # Redis for caching redis: image: redis:7-alpine ports: - "6379:6379" volumes: - redis_data:/data restart: unless-stopped command: redis-server --appendonly yes # PostgreSQL for data storage postgres: image: postgres:15-alpine ports: - "5432:5432" environment: - POSTGRES_DB=advanced_ai_research - POSTGRES_USER=app_user - POSTGRES_PASSWORD=secure_password_change_me volumes: - postgres_data:/var/lib/postgresql/data - ./scripts/init_db.sql:/docker-entrypoint-initdb.d/init.sql restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U app_user -d advanced_ai_research"] interval: 10s timeout: 5s retries: 5 # Nginx reverse proxy nginx: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx/nginx.conf:/etc/nginx/nginx.conf - ./nginx/ssl:/etc/nginx/ssl depends_on: - app restart: unless-stopped profiles: - production # Prometheus monitoring prometheus: image: prom/prometheus:latest ports: - "9090:9090" volumes: - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml - prometheus_data:/prometheus command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' - '--web.console.libraries=/etc/prometheus/console_libraries' - '--web.console.templates=/etc/prometheus/consoles' - '--storage.tsdb.retention.time=200h' - '--web.enable-lifecycle' restart: unless-stopped profiles: - monitoring # Grafana dashboard grafana: image: grafana/grafana:latest ports: - "3000:3000" environment: - GF_SECURITY_ADMIN_PASSWORD=admin_change_me volumes: - grafana_data:/var/lib/grafana - ./monitoring/grafana/dashboards:/etc/grafana/provisioning/dashboards - ./monitoring/grafana/datasources:/etc/grafana/provisioning/datasources depends_on: - prometheus restart: unless-stopped profiles: - monitoring # API service api: build: context: . target: production ports: - "8000:8000" environment: - PYTHONPATH=/app - API_HOST=0.0.0.0 - API_PORT=8000 volumes: - ./data:/app/data - ./models:/app/models command: ["python", "-m", "src.api.main"] restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 profiles: - api volumes: postgres_data: redis_data: prometheus_data: grafana_data: networks: default: name: advanced-ai-research-network