-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
292 lines (282 loc) · 9.5 KB
/
Copy pathdocker-compose.yml
File metadata and controls
292 lines (282 loc) · 9.5 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: ai-native-pr-platform
services:
postgres:
image: postgres:16.6-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-platform}
POSTGRES_USER: ${POSTGRES_USER:-platform}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-platform-dev-only}
volumes:
- platform_postgres_data:/var/lib/postgresql/data
networks:
- platform
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
security_opt:
- no-new-privileges:true
cap_drop: [ALL]
cap_add:
- CHOWN
- DAC_OVERRIDE
- FOWNER
- SETGID
- SETUID
gitea:
image: gitea/gitea:1.22.6-rootless
restart: unless-stopped
environment:
USER_UID: 1000
USER_GID: 1000
GITEA__database__DB_TYPE: postgres
GITEA__database__HOST: postgres:5432
GITEA__database__NAME: ${POSTGRES_DB:-platform}
GITEA__database__USER: ${POSTGRES_USER:-platform}
GITEA__database__PASSWD: ${POSTGRES_PASSWORD:-platform-dev-only}
GITEA__security__INSTALL_LOCK: "true"
GITEA__server__DOMAIN: ${GITEA_DOMAIN:-localhost}
GITEA__server__ROOT_URL: ${GITEA_ROOT_URL:-http://localhost:3001/}
GITEA__server__HTTP_PORT: 3000
GITEA__server__SSH_PORT: 2222
GITEA__server__SSH_LISTEN_PORT: 2222
GITEA__webhook__ALLOWED_HOST_LIST: private
ports:
- "${GITEA_PORT:-3001}:3000"
- "${GITEA_SSH_PORT:-2222}:2222"
volumes:
- platform_gitea_data:/var/lib/gitea
depends_on:
postgres:
condition: service_healthy
networks:
- platform
healthcheck:
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1:3000/ || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 20s
security_opt:
- no-new-privileges:true
cap_drop: [ALL]
registry:
image: registry:2.8.3
restart: unless-stopped
environment:
REGISTRY_STORAGE_DELETE_ENABLED: "true"
REGISTRY_HTTP_ADDR: 0.0.0.0:5000
ports:
- "${REGISTRY_DEBUG_PORT:-5001}:5000"
volumes:
- platform_registry_data:/var/lib/registry
- ./infra/registry/config.yml:/etc/docker/registry/config.yml:ro
command: ["/bin/registry", "serve", "/etc/docker/registry/config.yml"]
networks:
- platform
healthcheck:
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1:5000/v2/ || exit 1"]
interval: 5s
timeout: 5s
retries: 12
start_period: 5s
security_opt:
- no-new-privileges:true
cap_drop: [ALL]
# Run exactly one migration command before starting API and Worker. The
# application-owned migration entrypoint is intentionally configurable.
migrate:
build:
context: .
dockerfile: Dockerfile
target: api-runtime
image: ${PLATFORM_MIGRATOR_IMAGE:-platform-api:dev}
restart: "no"
environment:
DATABASE_URL: postgres://${POSTGRES_USER:-platform}:${POSTGRES_PASSWORD:-platform-dev-only}@postgres:5432/${POSTGRES_DB:-platform}
command: ["node", "packages/db/dist/migrate.js"]
depends_on:
postgres:
condition: service_healthy
networks:
- platform
security_opt:
- no-new-privileges:true
api:
build:
context: .
dockerfile: Dockerfile
target: api-runtime
image: ${PLATFORM_API_IMAGE:-platform-api:dev}
restart: unless-stopped
environment:
NODE_ENV: ${NODE_ENV:-development}
PORT: 3000
K8S_MODE: local
KUBECONFIG: /nonexistent
DATABASE_URL: postgres://${POSTGRES_USER:-platform}:${POSTGRES_PASSWORD:-platform-dev-only}@postgres:5432/${POSTGRES_DB:-platform}
GITEA_BASE_URL: ${GITEA_BASE_URL:-http://gitea:3000}
GITEA_PUBLIC_URL: ${GITEA_PUBLIC_URL:-http://localhost:3001}
GITEA_WEBHOOK_SECRET: ${GITEA_WEBHOOK_SECRET:-replace-with-a-32-byte-secret}
SESSION_ENCRYPTION_KEY: ${SESSION_ENCRYPTION_KEY:-replace-with-a-32-byte-session-key}
GITEA_OAUTH_CLIENT_ID: ${GITEA_OAUTH_CLIENT_ID:-}
GITEA_OAUTH_CLIENT_SECRET: ${GITEA_OAUTH_CLIENT_SECRET:-}
PLATFORM_PUBLIC_URL: ${PLATFORM_PUBLIC_URL:-http://localhost:3000}
AGENT_PROVIDER: ${AGENT_PROVIDER:-mock}
PREVIEW_MODE: local
REGISTRY_PUSH_HOST: ${COMPOSE_REGISTRY_HOST:-registry:5000}
REGISTRY_PULL_HOST: ${COMPOSE_REGISTRY_HOST:-registry:5000}
ports:
- "${API_PORT:-3000}:3000"
volumes:
- platform_logs:/var/log/platform
depends_on:
postgres:
condition: service_healthy
gitea:
condition: service_healthy
registry:
condition: service_healthy
migrate:
condition: service_completed_successfully
networks:
- platform
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3000/healthz').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 12
start_period: 15s
worker:
build:
context: .
dockerfile: Dockerfile
target: worker-runtime
image: ${PLATFORM_WORKER_IMAGE:-platform-worker:dev}
restart: unless-stopped
environment:
NODE_ENV: ${NODE_ENV:-development}
K8S_MODE: local
DATABASE_URL: postgres://${POSTGRES_USER:-platform}:${POSTGRES_PASSWORD:-platform-dev-only}@postgres:5432/${POSTGRES_DB:-platform}
GITEA_BASE_URL: ${GITEA_BASE_URL:-http://gitea:3000}
GITEA_RUNNER_BASE_URL: ${GITEA_RUNNER_BASE_URL:-http://host.k3d.internal:3001}
GITEA_PUBLIC_URL: ${GITEA_PUBLIC_URL:-http://localhost:3001}
GITEA_WEBHOOK_SECRET: ${GITEA_WEBHOOK_SECRET:-replace-with-a-32-byte-secret}
SESSION_ENCRYPTION_KEY: ${SESSION_ENCRYPTION_KEY:-replace-with-a-32-byte-session-key}
AGENT_PROVIDER: ${AGENT_PROVIDER:-mock}
WORKFLOW_EXECUTOR: ${WORKFLOW_EXECUTOR:-fixture}
K8S_STORAGE_CLASS: ${K8S_STORAGE_CLASS:-local-path}
K8S_JOB_TIMEOUT_MS: ${K8S_JOB_TIMEOUT_MS:-900000}
K8S_RUNNER_IMAGE: ${K8S_RUNNER_IMAGE:-registry.example.test/platform/runner@sha256:replace}
K8S_PREVIEW_IMAGE: ${K8S_PREVIEW_IMAGE:-registry.example.test/platform/preview@sha256:replace}
GITEA_RUNNER_TOKEN: ${GITEA_RUNNER_TOKEN:-}
GITEA_PLATFORM_TOKEN: ${GITEA_PLATFORM_TOKEN:-}
AGENT_REVIEW_URL: ${AGENT_REVIEW_URL:-http://agent-review:3002}
PREVIEW_MODE: local
REGISTRY_PUSH_HOST: ${COMPOSE_REGISTRY_HOST:-registry:5000}
REGISTRY_PULL_HOST: ${COMPOSE_REGISTRY_HOST:-registry:5000}
REGISTRY_API_URL: ${REGISTRY_API_URL:-http://registry:5000}
KUBECONFIG: /var/run/platform/kubeconfig
PORT: 3001
WORKER_HEALTH_PORT: 3001
command: ["node", "apps/worker/dist/main.js"]
volumes:
- platform_logs:/var/log/platform
- ${KUBECONFIG_WORKER:-./infra/k3d/kubeconfig.worker}:/var/run/platform/kubeconfig:ro
extra_hosts:
- host.docker.internal:host-gateway
depends_on:
postgres:
condition: service_healthy
gitea:
condition: service_healthy
registry:
condition: service_healthy
migrate:
condition: service_completed_successfully
networks:
- platform
read_only: true
tmpfs:
- /tmp:size=64m,mode=1777
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3001/healthz').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 6
start_period: 15s
# The web package is owned by a later target. Keep the deployment contract
# available without coupling this target to an implementation in apps/web.
web:
build:
context: .
dockerfile: Dockerfile
target: web-runtime
image: ${PLATFORM_WEB_IMAGE:-platform-web:dev}
restart: unless-stopped
ports:
- "${WEB_PORT:-8080}:80"
depends_on:
api:
condition: service_healthy
networks:
- platform
healthcheck:
test: ["CMD-SHELL", "wget --quiet --spider http://127.0.0.1/ || exit 1"]
interval: 10s
timeout: 5s
retries: 6
security_opt:
- no-new-privileges:true
agent-review:
build:
context: .
dockerfile: Dockerfile
target: agent-review-runtime
image: ${PLATFORM_AGENT_IMAGE:-platform-agent:dev}
restart: unless-stopped
environment:
NODE_ENV: ${NODE_ENV:-development}
AGENT_PROVIDER: ${AGENT_PROVIDER:-mock}
AGENT_MODEL_API_KEY: ${AGENT_MODEL_API_KEY:-}
command: ["node", "apps/agent-review/dist/main.js"]
ports:
- "${AGENT_REVIEW_PORT:-3002}:3002"
networks:
- platform
read_only: true
tmpfs:
- /tmp:size=32m,mode=1777
cap_drop: [ALL]
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:3002/healthz').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 6
start_period: 15s
networks:
platform:
name: ${COMPOSE_NETWORK_NAME:-ai-platform-compose}
volumes:
platform_postgres_data:
name: ${COMPOSE_POSTGRES_VOLUME:-ai-platform-compose-postgres}
platform_gitea_data:
name: ${COMPOSE_GITEA_VOLUME:-ai-platform-compose-gitea}
platform_registry_data:
name: ${COMPOSE_REGISTRY_VOLUME:-ai-platform-compose-registry}
platform_logs:
name: ${COMPOSE_LOG_VOLUME:-ai-platform-compose-logs}