-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
141 lines (132 loc) · 3.75 KB
/
Copy pathdocker-compose.yml
File metadata and controls
141 lines (132 loc) · 3.75 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
# One-command local development: `docker compose up`.
#
# Every app runs its dev server with the repo bind-mounted, so edits on the host
# hot-reload inside the container. `node_modules` is deliberately masked with an
# anonymous volume at each mount point — the host's tree is built for the host's
# platform and would shadow the image's Linux binaries (Prisma engines, SWC).
#
# Ports match the dev scripts: api 3000, dashboard 3001, www 3002, checkout 3003.
x-app-common: &app-common
restart: unless-stopped
networks: [tavvio]
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_DB: tavvio
POSTGRES_USER: tavvio
POSTGRES_PASSWORD: password
ports: ["5434:5432"]
volumes: ["pgdata:/var/lib/postgresql/data"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U tavvio -d tavvio"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
networks: [tavvio]
redis:
image: redis:7-alpine
ports: ["6379:6379"]
volumes: ["redisdata:/data"]
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
restart: unless-stopped
networks: [tavvio]
api:
<<: *app-common
build:
context: .
dockerfile: apps/api/Dockerfile
target: dev
ports: ["3000:3000"]
# Optional so a fresh clone comes up without one; copy .env.example first
# for anything that talks to Stellar or Circle.
env_file:
- path: .env
required: false
environment:
# Inside the compose network the services resolve by name and use the
# container-side ports, not the host-mapped ones.
DATABASE_URL: postgresql://tavvio:password@postgres:5432/tavvio
REDIS_URL: redis://redis:6379
PORT: "3000"
depends_on:
postgres: { condition: service_healthy }
redis: { condition: service_healthy }
volumes:
- .:/app
- /app/node_modules
- /app/apps/api/node_modules
healthcheck:
# /healthz is mounted outside the /v1 prefix (see api main.ts).
test: ["CMD-SHELL", "node -e \"fetch('http://localhost:3000/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))\""]
interval: 10s
timeout: 5s
retries: 12
start_period: 60s
dashboard:
<<: *app-common
build:
context: .
dockerfile: apps/dashboard/Dockerfile
target: dev
ports: ["3001:3001"]
env_file:
- path: apps/dashboard/.env.local
required: false
environment:
NEXT_PUBLIC_API_URL: http://localhost:3000/v1
NEXT_PUBLIC_API_BASE_URL: http://localhost:3000/v1
depends_on: [api]
volumes:
- .:/app
- /app/node_modules
- /app/apps/dashboard/node_modules
- /app/apps/dashboard/.next
www:
<<: *app-common
build:
context: .
dockerfile: apps/www/Dockerfile
target: dev
ports: ["3002:3002"]
env_file:
- path: apps/www/.env.local
required: false
environment:
NEXT_PUBLIC_API_URL: http://localhost:3000/v1
NEXT_PUBLIC_API_BASE_URL: http://localhost:3000/v1
depends_on: [api]
volumes:
- .:/app
- /app/node_modules
- /app/apps/www/node_modules
- /app/apps/www/.next
checkout:
<<: *app-common
build:
context: .
dockerfile: apps/checkout/Dockerfile
target: dev
ports: ["3003:3003"]
env_file:
- path: apps/checkout/.env.local
required: false
environment:
NEXT_PUBLIC_API_URL: http://localhost:3000/v1
NEXT_PUBLIC_API_BASE_URL: http://localhost:3000/v1
depends_on: [api]
volumes:
- .:/app
- /app/node_modules
- /app/apps/checkout/node_modules
- /app/apps/checkout/.next
networks:
tavvio:
volumes:
pgdata:
redisdata: