-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.dev.yml
executable file
·255 lines (235 loc) · 8.37 KB
/
docker-compose.dev.yml
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
version: '3.3'
networks:
mongo-compose-network:
driver: bridge
express-mongo:
driver: bridge
react-to-api:
driver: bridge
services:
# WIP - MVP - Integration of an 0Auth2 proxy
# oauth2-proxy:
# image: caarlos0/oauth2_proxy
# ports:
# - 127.0.0.1:4180:4180
# command:
# - '-client-id=123'
# - '-client-secret=456'
# - '-provider=github'
# - '-github-org=caarlos0-m'
# - '-email-domain=*'
# - '-cookie-secret=foo bar 1234'
# - '-cookie-secure=false'
# - '-upstream=http://nginx:80'
# - '-http-address=0.0.0.0:4180'
# - '-redirect-url=http://m.carlosbecker.com/oauth2/callback'
# - '-set-xauthrequest=true'
# WIP - MVP - nginx-reverse-proxy:
#nginx:
# image: nginx:1.21.5-alpine
# container_name: nginx
# restart: always
# ports:
# - 80:80
# volumes:
# - ./nginx/nginx-dev.conf:/etc/nginx/conf.d/default.conf
# depends_on:
# - api-dev
# - client-dev
# networks:
# expose one service - on the port 80, and we mount our config file to the /etc/nginx/conf.d folder.
# nginx will be the only thing facing the internet for real, and it will route traffic to the right places.
#prometheus:
# image: prom/prometheus:v2.32.1
# container_name: prometheus
# volumes:
# - ./prometheus:/etc/prometheus
# - prometheus_data:/prometheus
# command:
# - '--config.file=/etc/prometheus/prometheus.yml'
# - '--storage.tsdb.path=/prometheus'
# - '--web.console.libraries=/etc/prometheus/console_libraries'
# - '--web.console.templates=/etc/prometheus/consoles'
# - '--storage.tsdb.retention.time=200h'
# - '--web.enable-lifecycle'
# restart: unless-stopped
# ports:
# - "9090:9090"
# #expose:
# #- 9090
# networks:
# - log-net
# labels:
# org.label-schema.group: "health,logging & monitoring"
#
#alertmanager:
# image: prom/alertmanager:v0.23.0
# container_name: alertmanager
# volumes:
# - ./alertmanager:/etc/alertmanager
# command:
# - '--config.file=/etc/alertmanager/config.yml'
# - '--storage.path=/alertmanager'
# restart: unless-stopped
# ports:
# - "9093:9093"
# #expose:
# #- 9093
# networks:
# - log-net
# labels:
# org.label-schema.group: "health,logging & monitoring"
#nodeexporter:
# image: prom/node-exporter:v1.3.1
# #container_name: node-exporter
# #build:
# #dockerfile: Dockerfile
# #context: ./cineexporter/app
# #volumes:
# #- './cineexporter/app:/app'
# #- './cineexporter/app/node_modules'
# #image: prom/node-exporter:latest
# container_name: nodeexporter
# volumes:
# - /proc:/host/proc:ro
# - /sys:/host/sys:ro
# - /:/rootfs:ro
# #- /:/host:ro,rslave
# command:
# - '--path.procfs=/host/proc'
# - '--path.rootfs=/rootfs'
# #- '--path.rootfs=/host'
# - '--path.sysfs=/host/sys'
# - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
# restart: unless-stopped
# #expose:
# #- 9100
# networks:
# - log-net
# labels:
# org.label-schema.group: "health,logging & monitoring"
# ports:
# - "9100:9100"
# Let’s break this down. basically, we are telling Docker to use the current directory as a context
# where to run everything and use the Dockerfile found in the local directory.
# Then we are telling docker to name the image built reactapp_image and the container
# reactapp_container We are also telling docker to map our local machines port 8000 to
# the containers port 8000 . Then since we want all code changes we make locally to be reflected
# in our prod server we are going to map our current directory to the containers /app directory
# where our application runs in.
# Parameters description
# db & graphql: Names of the services run by Docker Compose.
# container_name: Guess what? It’s the container name!
# image: Name of the image to use to run the container.
# build: When a build context is provided, Docker Compose will build a custom image using the Dockerfile located in the context folder.
# context: Indicates the folder where to find the Dockerfile to build the image.
# volumes: Mapping between the project folder on your host machine and the PostgreSQL folder in your container, in format host_folder:container_folder. All the files generated in the container_folder will be copied in the host_folder so that you can preserve and retrieve your data when stopping/restarting the container. Replace the host folder by the destination of your choice. If it does not exist it will be automatically created.
# environment: Environment variables for the container. POSTGRES_PASSWORD sets the password of PostgreSQL superuser. Value is 1234 in the example above but you should pick a stronger password of your choice. This variable should not be written in the docker-compose file but rather in a .env file which must not be committed in your Git repository.
# expose: Port number of the container to be exposed to the outside.
# ports: Port, mapping between the port of your host machine and the port of your container, in format host_port:container_port.
# networks: Networks are used to group and connect containers as part of a same network.
# command: Command to be executed after the container starts. Each argument must be provided in a separate list item.
# Ports mentioned in docker-compose.yml will be shared among different services started by the docker-compose.
# Ports will be exposed to the host machine to a random port or a given port.
# Expose ports without publishing them to the host machine - they’ll only be accessible to linked services. Only the internal port can be specified.
# Ports are not exposed to host machines, only exposed to other services.
storybook:
build:
# set Context to any frontend library, such as the storybook, frontend framework, or any app.
context: ./frontend/storybook/
dockerfile: Dockerfile.dev
restart: always
image: storybook-image
container_name: storybook-image
stdin_open: true
volumes:
- ./frontend/storybook/app:/app
- /usr/src/app/node_modules
ports:
- 2000:2000
#The React development server will be running inside the container and will be watching the src folder.
#links:
# - express
env_file:
- .env
environment:
#React specific....
- CHOKIDAR_USEPOLLING=true
#depends_on:
# - express-api
#depends_on:
# - backend
networks:
- react-to-api
backend:
build:
context: ./backend/todoapp-express-backend/app
dockerfile: Dockerfile.dev
restart: always
image: backend-image
container_name: backend
volumes:
- ./backend/todoapp-express-backend/app:/app
- /usr/src/app/node_modules
ports:
- 4000:4000
links:
- mongo
#depends_on:
# - mongodb
# ENVIRONMET_VARIABLE_NAME: "environment variable value"
#According to your docker-compose.yaml file you can access you mongo container on 127.0.0.1:27017
#only from host machine.
#In order to access it from NodeJS backend container you should use db:27017.
environment:
- mongoURI=${MONGO_URI}
depends_on:
- mongo
networks:
- express-mongo
- react-to-api
#expose:
# - 4000
mongodb:
image: mongo
container_name: mongodb
restart: always
ports:
- 27017:27017
environment:
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USER}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD}
volumes:
- mongodb:/data/db
command: mongod
networks:
- express-mongo
- mongo-compose-network
expose:
- 27017
mongo-seed:
build: ./backend/mongo-seed
restart: always
image: mongo-seed
container_name: mongo-seed
networks:
- mongo-compose-network
mongo-express:
image: mongo-express
container_name: mongo-express
depends_on:
- mongodb
networks:
- mongo-compose-network
environment:
- ME_CONFIG_MONGODB_ADMINUSERNAME=${MONGO_ROOT_USER}
- ME_CONFIG_MONGODB_ADMINPASSWORD=${MONGO_ROOT_PASSWORD}
- ME_CONFIG_MONGODB_SERVER=${MONGO_SERVER}
#- ME_CONFIG_BASICAUTH_USERNAME=admin
#- ME_CONFIG_BASICAUTH_PASSWORD=password
ports:
- '8081:8081'
volumes:
- mongodb:/data/db
volumes:
mongodb: