File size: 2,571 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
version: '3.8'

# ==========================================
# SAAP Docker Compose - Production Override
# Usage: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# ==========================================

services:
  # PostgreSQL - Production Settings
  postgres:
    environment:
      POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C --data-checksums"
    volumes:
      # Production: Use named volume without host mount
      - postgres_data:/var/lib/postgresql/data
    # Remove port exposure for security (only accessible within network)
    ports: []
    command:
      - "postgres"
      - "-c"
      - "shared_buffers=256MB"
      - "-c"
      - "max_connections=100"
      - "-c"
      - "work_mem=4MB"
      - "-c"
      - "maintenance_work_mem=64MB"
      - "-c"
      - "effective_cache_size=1GB"
      - "-c"
      - "log_statement=all"
      - "-c"
      - "log_duration=on"

  # Backend - Production Settings
  backend:
    # Use pre-built image from registry instead of building
    image: ghcr.io/satwareag/saap/backend:latest
    build:
      context: ./backend
      dockerfile: Dockerfile
      target: runtime
    environment:
      # Override development settings
      ENVIRONMENT: production
      DEBUG: "false"
      LOG_LEVEL: WARNING
      
      # Production CORS (whitelist specific domains)
      CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost}
      
      # Production workers
      WORKERS: ${WORKERS:-4}
      
    volumes:
      # Remove source code mount - use image only
      - backend_logs:/app/logs
    # Remove port exposure for security (accessed via frontend proxy)
    ports: []

  # Frontend - Production Settings
  frontend:
    # Use pre-built image from registry instead of building
    image: ghcr.io/satwareag/saap/frontend:latest
    build:
      context: ./frontend
      dockerfile: Dockerfile
      target: runtime
    environment:
      # Production API URL (internal network)
      VITE_API_BASE_URL: http://backend:8000
      VITE_WS_URL: ws://backend:8000/ws
    ports:
      # Expose only frontend port
      - "80:80"

# Production volumes with backup labels
volumes:
  postgres_data:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ${DATA_PATH:-./data}/postgres
    labels:
      - "backup.enable=true"
      - "backup.frequency=daily"
  backend_logs:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: ${DATA_PATH:-./data}/logs
    labels:
      - "backup.enable=true"
      - "backup.frequency=weekly"