-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
144 lines (132 loc) · 3.01 KB
/
docker-compose.yaml
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
version: '3.9'
services:
### BUILDER
###
nx-builder:
build:
context: .
dockerfile: Dockerfile.builder
command: ['nx', 'run-many', '--target=build', '--parallel', '--watch']
environment:
- DATABASE_URL=postgres://beef:changeme@database:5432/beefme
volumes:
- app_dist:/builder/dist
- modules:/builder/node_modules
- ./package.json:/builder/package.json
- ./nx.json:/builder/nx.json
- ./tsconfig.base.json:/builder/tsconfig.base.json
- ./apps:/builder/apps
- ./libs:/builder/libs
- ./tools:/builder/tools
### BROKER
###
kafka:
image: docker.io/bitnami/kafka:3.3
ports:
- '9092:9092'
volumes:
- 'kafka_data:/bitnami'
environment:
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
depends_on:
- zookeeper
zookeeper:
image: docker.io/bitnami/zookeeper:3.8
ports:
- '2181:2181'
volumes:
- 'zookeeper_data:/bitnami'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
### DATA LAYER
###
database:
image: postgres:15.1
environment:
- POSTGRES_PASSWORD=changeme
- POSTGRES_USER=beef
- POSTGRES_DB=beefme
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- ./data/database:/var/lib/postgresql/data
ports:
- '5432:5432'
# mongo:
# image: mongo
# restart: always
# ports:
# - "27017:27017"
# volumes:
# - ./data/mongo:/data/db
### SERVICE LAYER
###
api:
build:
context: .
dockerfile: ./Dockerfile.runner
args:
SERVICE_NAME: api
ports:
- '3000:3000'
working_dir: /app
environment:
- SERVICE_NAME=api
command: ['nodemon', '--exec', 'node', '/app/dist/apps/api/main.js']
volumes:
- app_dist:/app/dist:ro
- modules:/app/node_modules:ro
depends_on:
- nx-builder
- database
- kafka
- zookeeper
domain:
build:
context: .
dockerfile: ./Dockerfile.runner
args:
SERVICE_NAME: domain
ports:
- '3002:3000'
working_dir: /app
environment:
- DATABASE_URL=postgres://beef:changeme@database:5432/beefme
- SERVICE_NAME=domain
command: ['nodemon', '--exec', 'node', '/app/dist/apps/domain/main.js']
volumes:
- app_dist:/app/dist:ro
- modules:/app/node_modules:ro
depends_on:
- nx-builder
- database
- kafka
- zookeeper
feed-consumer:
build:
context: .
dockerfile: ./Dockerfile.runner
args:
SERVICE_NAME: feed-consumer
ports:
- '3001:3000'
working_dir: /app
environment:
- SERVICE_NAME=feed-consumer
command:
['nodemon', '--exec', 'node', '/app/dist/apps/feed-consumer/main.js']
volumes:
- app_dist:/app/dist:ro
- modules:/app/node_modules:ro
depends_on:
- nx-builder
- database
- kafka
- zookeeper
volumes:
zookeeper_data:
driver: local
kafka_data:
driver: local
modules:
app_dist: