-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
106 lines (101 loc) · 2.57 KB
/
docker-compose.yml
File metadata and controls
106 lines (101 loc) · 2.57 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
# Docker Compose для AI_AGENT
# Запуск: docker-compose up --build
# Остановка: docker-compose down
services:
# Backend API (FastAPI + Uvicorn)
backend:
build:
context: .
dockerfile: Dockerfile
container_name: ai_agent_backend
ports:
- "8000:8000"
volumes:
# Persist сессий и данных
- ./workspace:/app/workspace
# Для hot-reload в dev режиме (убрать в production!)
- ./backend:/app/backend
env_file:
- .env
environment:
- PYTHONUNBUFFERED=1
- SANDBOX_URL=http://sandbox:8001 # URL sandbox service
depends_on:
sandbox:
condition: service_healthy
restart: unless-stopped
networks:
- default
- internal
# Security options
security_opt:
- no-new-privileges:true
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8000/health" ]
interval: 30s
timeout: 10s
retries: 3
# Sandbox Code Executor (Isolated)
sandbox:
build:
context: ./sandbox
dockerfile: Dockerfile
container_name: ai_agent_sandbox
volumes:
# Shared workspace for code execution
- ./workspace:/workspace
# Security: No network access to external world
# Only internal docker network for backend communication
networks:
- internal
# Resource limits
deploy:
resources:
limits:
cpus: '1.0'
memory: 1G
reservations:
cpus: '0.25'
memory: 256M
# Security options
security_opt:
- no-new-privileges:true
# Make most of filesystem read-only
read_only: true
tmpfs:
- /tmp:size=100M
- /home/sandbox:size=50M
restart: unless-stopped
healthcheck:
test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" ]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
# Frontend (Vite + React)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: ai_agent_frontend
ports:
- "3000:5173"
volumes:
# Для hot-reload
- ./frontend/src:/app/src
- ./frontend/index.html:/app/index.html
# Добавляем vite.config для hot-reload конфигурации
- ./frontend/vite.config.ts:/app/vite.config.ts
depends_on:
- backend
restart: unless-stopped
# Networks
networks:
internal:
driver: bridge
default:
driver: bridge
# Volumes для persistence
volumes:
workspace_data:
driver: local