-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
101 lines (94 loc) · 3.03 KB
/
Copy pathdocker-compose.yml
File metadata and controls
101 lines (94 loc) · 3.03 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
# ---------------------------------------------------------------
# Local one-command dev stack.
#
# Usage:
# docker compose up --build # frontend + api + redis
# docker compose --profile test run --rm smoke # vision worker smoke
# docker compose --profile test run --rm api-test # backend unit tests
# docker compose --profile test run --rm e2e # Playwright suite
# ---------------------------------------------------------------
services:
redis:
image: redis:7.4-alpine
command: ["redis-server", "--appendonly", "yes"]
ports: ["6379:6379"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 2s
retries: 5
start_period: 5s
volumes: [redis-data:/data]
api:
build:
context: .
dockerfile: Dockerfile.api
environment:
REDIS_URL: redis://redis:6379
MODEL_BASE_URL: http://web:8080/models
PORT: "8081"
ports: ["8081:8081"]
depends_on:
redis: { condition: service_healthy }
web: { condition: service_started }
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8081/readyz"]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
web:
build:
context: .
dockerfile: Dockerfile
ports: ["8080:8080"]
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/healthz"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s
# Sidecar: tails /readyz + /diagnostics/vision so a `docker compose up`
# surfaces probe state continuously without needing kubectl.
diagnostics-tail:
image: alpine:3.20
depends_on:
api: { condition: service_healthy }
command:
- sh
- -c
- |
apk add --no-cache curl jq >/dev/null
echo "[diagnostics-tail] polling api every 15s"
while true; do
ts=$$(date -u +%FT%TZ)
echo "[$$ts] /readyz:" && curl -fsS http://api:8081/readyz | jq -c . || echo " (down)"
echo "[$$ts] /diagnostics/vision:" && curl -fsS http://api:8081/diagnostics/vision | jq -c '{ok, models: [.models[] | {file, ok, status}]}' || echo " (down)"
sleep 15
done
# On-demand: vision.worker smoke test (bundle + model URL resolution)
smoke:
image: oven/bun:1.1-alpine
working_dir: /app
volumes: [".:/app"]
command: ["sh", "-c", "bun install --frozen-lockfile && bun run smoke:vision-worker"]
profiles: ["test"]
api-test:
image: oven/bun:1.1-alpine
working_dir: /app/apps/api
volumes: [".:/app"]
command: ["sh", "-c", "cd /app/apps/api && bun install && bun test"]
profiles: ["test"]
e2e:
image: mcr.microsoft.com/playwright:v1.48.0-jammy
working_dir: /app
volumes: [".:/app"]
environment:
E2E_BASE_URL: http://web:8080
command: ["sh", "-c", "npx -y playwright@1.48.0 test -c playwright.config.ts"]
depends_on:
web: { condition: service_healthy }
api: { condition: service_healthy }
profiles: ["test"]
volumes:
redis-data: