-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
166 lines (130 loc) · 3.9 KB
/
docker-compose.yml
File metadata and controls
166 lines (130 loc) · 3.9 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# SafeOS Guardian - Docker Compose Configuration
# Run: docker-compose up -d
version: '3.8'
services:
# =============================================================================
# Backend API Server
# =============================================================================
api:
build:
context: .
target: backend
container_name: safeos-api
restart: unless-stopped
ports:
- "3001:3001"
environment:
- NODE_ENV=production
- SAFEOS_PORT=3001
- SAFEOS_DB_PATH=/app/db_data/safeos.sqlite3
- OLLAMA_HOST=${OLLAMA_HOST:-http://host.docker.internal:11434}
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
- OPENAI_API_KEY=${OPENAI_API_KEY:-}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- TWILIO_ACCOUNT_SID=${TWILIO_ACCOUNT_SID:-}
- TWILIO_AUTH_TOKEN=${TWILIO_AUTH_TOKEN:-}
- TWILIO_PHONE_NUMBER=${TWILIO_PHONE_NUMBER:-}
- TELEGRAM_BOT_TOKEN=${TELEGRAM_BOT_TOKEN:-}
volumes:
- safeos-data:/app/db_data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- safeos-network
extra_hosts:
- "host.docker.internal:host-gateway"
# =============================================================================
# Frontend UI
# =============================================================================
ui:
build:
context: .
target: frontend
container_name: safeos-ui
restart: unless-stopped
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_URL=http://localhost:3001
- NEXT_PUBLIC_WS_URL=ws://localhost:3001
depends_on:
api:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
networks:
- safeos-network
# =============================================================================
# Redis (Optional - for production scaling)
# =============================================================================
redis:
image: redis:7-alpine
container_name: safeos-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- safeos-network
profiles:
- production
# =============================================================================
# Ollama (Local AI - if not running on host)
# =============================================================================
ollama:
image: ollama/ollama:latest
container_name: safeos-ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ollama-models:/root/.ollama
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:11434/api/tags"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
networks:
- safeos-network
profiles:
- with-ollama
# =============================================================================
# Volumes
# =============================================================================
volumes:
safeos-data:
driver: local
redis-data:
driver: local
ollama-models:
driver: local
# =============================================================================
# Networks
# =============================================================================
networks:
safeos-network:
driver: bridge