File size: 2,733 Bytes
4343907
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# ==========================================
# SAAP Docker Compose - Development Setup
# ==========================================

services:
  # PostgreSQL Database
  postgres:
    image: postgres:15-alpine
    container_name: saap-postgres
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-saap_db}
      POSTGRES_USER: ${POSTGRES_USER:-saap_user}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-saap_password}
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "${POSTGRES_PORT:-5432}:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-saap_user} -d ${POSTGRES_DB:-saap_db}"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - saap-network
    restart: unless-stopped

  # Backend API (FastAPI)
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: saap-backend
    env_file:
      - backend/.env
    environment:
      # Database - Direct PostgreSQL connection
      DATABASE_URL: postgresql://saap_user:saap_password@postgres:5432/saap_db
      
      # API Keys (from .env file)
      COLOSSUS_API_KEY: ${COLOSSUS_API_KEY}
      OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
      
      # Application Settings  
      ENVIRONMENT: production
      DEBUG: ${DEBUG:-false}
      LOG_LEVEL: ${LOG_LEVEL:-INFO}
      
      # CORS Settings
      CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5173,http://localhost:80}
      
      # Security
      SECRET_KEY: ${SECRET_KEY:-dev-secret-key-change-in-production}
      
    volumes:
      - ./backend:/app
      - backend_logs:/app/logs
    ports:
      - "${BACKEND_PORT:-8000}:8000"
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      - saap-network
    restart: unless-stopped

  # Frontend (Vue.js + Nginx)
  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: saap-frontend
    environment:
      VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8000}
      VITE_WS_URL: ${VITE_WS_URL:-ws://localhost:8000/ws}
    ports:
      - "${FRONTEND_PORT:-5173}:80"
    depends_on:
      - backend
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost/"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    networks:
      - saap-network
    restart: unless-stopped

networks:
  saap-network:
    driver: bridge

volumes:
  postgres_data:
    driver: local
  backend_logs:
    driver: local