This repository was archived by the owner on Nov 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
78 lines (74 loc) · 2.49 KB
/
docker-compose.dev.yml
File metadata and controls
78 lines (74 loc) · 2.49 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
# https://docs.traefik.io/user-guides/docker-compose/basic-example/
version: '3.7'
services:
proxy-traefik:
image: traefik:latest # check dockerfile ENV before deploying
volumes:
- "./traefik/traefik.dev.yaml:/etc/traefik/traefik.yaml" # without proper directory, it'll show no logs
- "/var/run/docker.sock:/var/run/docker.sock"
ports:
- "80:80"
- "433:433"
- "8080:8080" # dashboard
deploy: # specify configuration for services(not container)
labels:
- traefik.http.routers.proxy-testapp.rule=Host(`traefik.127.0.0.1.xip.io`) # must use backtick(`) instead of single quote(') - GoLang's feature
- traefik.http.services.proxy-testapp.loadbalancer.server.port=8080
- traefik.docker.network=web-internal
placement:
constraints:
- node.role == manager
preferences:
- spread: node.id
networks:
- web-internal
front:
image: test-app-dev_front:latest
# ports: # FOR DEBUG PURPOSE - must be disabled in PROD
# - "3000:3000"
deploy:
labels:
- traefik.http.routers.web-testapp.rule=Host(`127.0.0.1.xip.io`)
- traefik.http.routers.web-testapp.entrypoints=web # open to :80
- traefik.http.services.web-testapp.loadbalancer.server.port=3000
- traefik.docker.network=web-internal
- traefik.enable=true
volumes:
- "./frontend/src:/node/myapp/src"
- "./frontend/public:/node/myapp/public"
networks:
- web-internal
api:
image: test-app-dev_api:latest
# ports: # FOR DEBUG PURPOSE - must be disabled in PROD
# - "4000:4000"
deploy:
labels:
- traefik.http.routers.api-testapp.rule=Host(`api.127.0.0.1.xip.io`)
- traefik.http.routers.api-testapp.entrypoints=web
- traefik.http.services.api-testapp.loadbalancer.server.port=4000
- traefik.enable=true
environment:
- "WHITELIST=127.0.0.1.xip.io,http://127.0.0.1.xip.io"
- "MONGO_URI=mongodb:27017"
- MONGO_USERNAME=admin
- MONGO_PASSWORD=1234
networks:
- web-internal
mongodb:
image: mongo:latest
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=1234
volumes:
- "mongo-data:/data/db"
networks:
- web-internal
networks:
web-internal:
name: web-internal
driver: overlay # allows contact different nodes
# attachable: true # outside container can be attached to this network
volumes:
front-node_modules:
mongo-data: