-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
84 lines (80 loc) · 2.11 KB
/
Copy pathdocker-compose.yml
File metadata and controls
84 lines (80 loc) · 2.11 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
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: xelma
POSTGRES_USER: xelma
POSTGRES_PASSWORD: xelma
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U xelma -d xelma"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
redis:
image: redis:7-alpine
restart: unless-stopped
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
api:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- "3000:3000"
env_file:
- .env
environment:
PORT: 3000
DATABASE_URL: postgresql://xelma:xelma@postgres:5432/xelma
# Distributed idempotency locks (Issue #493) fail closed without Redis,
# so the API service is wired to the compose Redis instance.
REDIS_URL: redis://redis:6379
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
# Full mode (default) — health route lives at GET /health (root, outside /api).
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:${PORT:-3000}/health || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 45s
hackathon:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
profiles: ["hackathon"]
ports:
- "3001:3001"
env_file:
- .env.hackathon.example
environment:
PORT: 3001
API_MODE: hackathon
# Hackathon health route lives at GET /api/health.
# The entrypoint also sets HEALTHCHECK_PATH automatically when
# API_MODE=hackathon, but we set it here for the compose-level probe.
HEALTHCHECK_PATH: /api/health
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3001/api/health || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 45s
volumes:
postgres_data: