-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.dev.yaml
More file actions
152 lines (144 loc) · 5.33 KB
/
compose.dev.yaml
File metadata and controls
152 lines (144 loc) · 5.33 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
services:
# ── PostgreSQL ─────────────────────────────────────────────────────────────
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: fintrack
POSTGRES_PASSWORD: fintrack
POSTGRES_DB: fintrack
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U fintrack -d fintrack" ]
interval: 10s
timeout: 5s
retries: 5
# ── pgAdmin ────────────────────────────────────────────────────────────────
pgadmin:
image: dpage/pgadmin4:latest
environment:
PGADMIN_DEFAULT_EMAIL: admin@fintrack.dev
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- "5050:80"
volumes:
- pgadmin_data:/var/lib/pgadmin
depends_on:
postgres:
condition: service_healthy
# ── Init (Dependency Installation & Preparation) ───────────────────────────
init:
image: node:22-alpine
working_dir: /app
volumes:
- .:/app
- root_node_modules:/app/node_modules
- api_node_modules:/app/apps/api/node_modules
- bot_node_modules:/app/apps/bot/node_modules
- web_node_modules:/app/apps/web/node_modules
- types_node_modules:/app/packages/types/node_modules
# npm install is used instead of ci to benefit from caching in named volumes.
command: sh -c "npm install && npm --prefix packages/types run build && npm
--prefix apps/api run prisma:generate"
# ── API ────────────────────────────────────────────────────────────────────
api:
image: node:22-alpine
working_dir: /app/apps/api
volumes:
- .:/app
- root_node_modules:/app/node_modules
- api_node_modules:/app/apps/api/node_modules
- types_node_modules:/app/packages/types/node_modules
ports:
- "8000:8000"
- "5555:5555" # Expose Prisma Studio port
environment:
- NODE_ENV=development
- DX_SERVICE_NAME=api
env_file:
- apps/api/.env.docker
# Apply any pending migrations before starting the dev server.
# `migrate deploy` is safe to run repeatedly — it only applies new migrations.
command: sh -c "npm run prisma:migrate:deploy && npm run dev"
depends_on:
postgres:
condition: service_healthy
init:
condition: service_completed_successfully
# ── Runner (CLI Tooling) ───────────────────────────────────────────────────
# Utility service for one-off commands (lint, test, seed, scripts).
# Use: docker compose -f compose.dev.yaml run --rm runner <command>
runner:
build:
context: .
dockerfile: scripts/Dockerfile.runner
working_dir: /app
profiles: [ "tools" ] # Prevent starting automatically with 'up'
volumes:
- .:/app
- root_node_modules:/app/node_modules
- api_node_modules:/app/apps/api/node_modules
- bot_node_modules:/app/apps/bot/node_modules
- web_node_modules:/app/apps/web/node_modules
- types_node_modules:/app/packages/types/node_modules
environment:
- DX_SERVICE_NAME=runner
env_file:
- apps/api/.env.docker
# Interactive shell by default
command: bash
# ── Telegram bot ───────────────────────────────────────────────────────────
bot:
image: node:22-alpine
working_dir: /app/apps/bot
volumes:
- .:/app
- root_node_modules:/app/node_modules
- bot_node_modules:/app/apps/bot/node_modules
- types_node_modules:/app/packages/types/node_modules
environment:
- NODE_ENV=development
- DX_SERVICE_NAME=bot
env_file:
- apps/bot/.env.docker
command: npm run dev
depends_on:
init:
condition: service_completed_successfully
api:
condition: service_started
# ── Next.js web ────────────────────────────────────────────────────────────
web:
image: node:22-alpine
working_dir: /app/apps/web
volumes:
- .:/app
- root_node_modules:/app/node_modules
- web_node_modules:/app/apps/web/node_modules
- types_node_modules:/app/packages/types/node_modules
- web_next:/app/apps/web/.next
ports:
- "5173:5173"
environment:
- NODE_ENV=development
- NEXT_PUBLIC_API_URL=http://localhost:8000/api
- DX_SERVICE_NAME=web
env_file:
- apps/web/.env.docker
command: npm run dev
depends_on:
init:
condition: service_completed_successfully
api:
condition: service_started
volumes:
postgres_data:
pgadmin_data:
root_node_modules:
api_node_modules:
bot_node_modules:
web_node_modules:
types_node_modules:
web_next: