-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (115 loc) · 3.34 KB
/
docker-compose.yml
File metadata and controls
122 lines (115 loc) · 3.34 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
name: trustlayer
# Uzywamy Docker Compose profili zeby uniknac duplikacji:
# docker compose --profile dev up -> hot-reload dla obu serwisow
# docker compose --profile prod up -> build + uruchomienie produkcyjne
# Default (bez profilu) nie odpala nic.
services:
# =========================================================
# DEV — hot reload, bind-mount kodu
# =========================================================
backend-dev:
profiles: ["dev"]
build:
context: ./backend
target: dev
container_name: trustlayer-backend-dev
ports:
- "8000:8000"
volumes:
# Bind-mount kodu -> uvicorn watchuje zmiany
- ./backend/app:/app/app:cached
# Anonimowy volume dla demo_data (zeby container je seedował)
- backend_demo:/app/app/demo_data
environment:
PYTHONPATH: /app
TRUSTLAYER_ENV: development
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/api/health"]
interval: 15s
timeout: 3s
retries: 3
start_period: 5s
networks:
- trustlayer
frontend-dev:
profiles: ["dev"]
build:
context: ./frontend
target: dev
container_name: trustlayer-frontend-dev
ports:
- "3000:3000"
volumes:
# Bind-mount wszystkiego poza node_modules i .next
- ./frontend/app:/app/app:cached
- ./frontend/components:/app/components:cached
- ./frontend/lib:/app/lib:cached
- ./frontend/public:/app/public:cached
- ./frontend/next.config.mjs:/app/next.config.mjs:cached
- ./frontend/tailwind.config.mjs:/app/tailwind.config.mjs:cached
- ./frontend/postcss.config.mjs:/app/postcss.config.mjs:cached
- ./frontend/tsconfig.json:/app/tsconfig.json:cached
# Anonimowe volumes dla node_modules i .next (zostaja w kontenerze)
- /app/node_modules
- /app/.next
environment:
NODE_ENV: development
BACKEND_URL: http://backend-dev:8000
WATCHPACK_POLLING: "true"
CHOKIDAR_USEPOLLING: "true"
depends_on:
backend-dev:
condition: service_healthy
networks:
- trustlayer
# =========================================================
# PROD — build + statyczny serve, non-root, zdrowie
# =========================================================
backend:
profiles: ["prod"]
build:
context: ./backend
target: prod
image: trustlayer/backend:latest
container_name: trustlayer-backend
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- backend_data:/app/app/demo_data
environment:
TRUSTLAYER_ENV: production
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:8000/api/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
networks:
- trustlayer
frontend:
profiles: ["prod"]
build:
context: ./frontend
target: prod
args:
BACKEND_URL: http://backend:8000
image: trustlayer/frontend:latest
container_name: trustlayer-frontend
restart: unless-stopped
ports:
- "3000:3000"
environment:
BACKEND_URL: http://backend:8000
NODE_ENV: production
depends_on:
backend:
condition: service_healthy
networks:
- trustlayer
networks:
trustlayer:
driver: bridge
volumes:
backend_demo: # dev
backend_data: # prod