Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (119 loc) · 3.23 KB
/
Copy pathdocker-compose.yml
File metadata and controls
125 lines (119 loc) · 3.23 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
services:
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=codepulse
- POSTGRES_USER=codepulse
- POSTGRES_PASSWORD=${DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U codepulse -d codepulse"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
ports:
- "127.0.0.1:6379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 5s
timeout: 3s
retries: 5
sandbox-sidecar:
build:
context: ./backend/sandbox_sidecar
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- MIN_POOL_SIZE=${MIN_POOL_SIZE:-10}
- MAX_POOL_SIZE=${MAX_POOL_SIZE:-30}
- MAX_REUSE=${MAX_REUSE:-50}
- CONTAINER_TIMEOUT=${CONTAINER_TIMEOUT:-10}
- ACQUIRE_TIMEOUT=${ACQUIRE_TIMEOUT:-8}
restart: unless-stopped
backend:
image: codepulse-backend
build:
context: ./backend
args:
REGISTRY_PREFIX: ${REGISTRY_PREFIX:-}
ports:
- "5000:5000"
volumes:
- ./backend:/app
- /app/__pycache_
- fastembed_cache:/tmp/fastembed_cache
env_file:
- .env
environment:
- DATABASE_URL=${DATABASE_URL}
- OAUTHLIB_RELAX_TOKEN_SCOPE=1
- SANDBOX_SIDECAR_URL=http://sandbox-sidecar:8080
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
- USE_CELERY=1
depends_on:
postgres:
condition: service_healthy
sandbox-sidecar:
condition: service_started
redis:
condition: service_healthy
command: python app.py
celery-worker:
# 與 backend 共用同一個 image,避免重複 build
image: codepulse-backend
pull_policy: never
volumes:
- ./backend:/app
- /app/__pycache_
- fastembed_cache:/tmp/fastembed_cache
env_file:
- .env
environment:
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=redis://:${REDIS_PASSWORD}@redis:6379/0
- SANDBOX_SIDECAR_URL=http://sandbox-sidecar:8080
- USE_CELERY=1
depends_on:
# image 由 backend 的 build 產生,單獨啟動 celery 時也要先 build backend
backend:
condition: service_started
redis:
condition: service_healthy
postgres:
condition: service_healthy
sandbox-sidecar:
condition: service_started
command: >
celery -A celery_worker worker
--loglevel=info
--concurrency=2
--pool=prefork
-Q celery,interactive
# Vite dev server
frontend:
build:
context: ./frontend
args:
REGISTRY_PREFIX: ${REGISTRY_PREFIX:-}
ports:
- "5173:5173"
volumes:
- ./frontend:/app:delegated
- /app/node_modules
environment:
# Vite proxy target (server-side only, NOT exposed to browser JS)
- PROXY_TARGET=http://backend:5000
# OAuth redirect: 瀏覽器直接訪問 Flask,不走 Vite proxy
- VITE_BACKEND_URL=http://localhost:5000
depends_on:
- backend
volumes:
postgres_data:
fastembed_cache: