-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
122 lines (122 loc) · 4.19 KB
/
docker-compose.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
version: "3.8"
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2
# Enables the web UI and tells Traefik to listen to docker
command:
- "--api.insecure=true"
- "--providers.docker"
- "--providers.docker.exposedByDefault=false"
ports:
# The HTTP port
- "80:80"
# The Web UI (enabled by --api.insecure=true)
- "8080:8080"
volumes:
# So that Traefik can listen to the Docker events
- /var/run/docker.sock:/var/run/docker.sock
postgres-account:
image: "postgres:alpine"
environment:
- POSTGRES_PASSWORD=password
ports:
- "5432:5432"
# Set a volume for data and initial sql script
# May configure initial db for future demo
volumes:
- "pgdata_account:/var/lib/postgresql/data"
# - ./init:/docker-entrypoint-initdb.d/
command: ["postgres", "-c", "log_statement=all"]
postgres-words:
image: "postgres:alpine"
environment:
- POSTGRES_PASSWORD=password
ports:
- "5433:5432"
# Set a volume for data and initial sql script
# May configure initial db for future demo
volumes:
- "pgdata_words:/var/lib/postgresql/data"
# - ./init:/docker-entrypoint-initdb.d/
command: [ "postgres", "-c", "log_statement=all" ]
redis-account:
image: "redis:alpine"
ports:
- "6379:6379"
volumes:
- "redisdata:/data"
account:
build:
context: ./account
target: builder
image: account
env_file: ./account/.env.dev
expose:
- "8080"
labels:
- "traefik.enable=true"
- "traefik.http.routers.account.rule=Host(`malcorp.test`) && PathPrefix(`/api/account`)"
environment:
- ENV=dev
volumes:
- ./account:/go/src/app
# have to use $$ (double-dollar) so docker doesn't try to substitute a variable
depends_on:
- postgres-account
- redis-account
- reverse-proxy
command: reflex -r "\.go$$" -s -- sh -c "go run ./"
account-client:
build:
context: ./account-client
image: account-client # if we don't give image name, traefik won't create router 🤷♂️
expose:
- "3000"
ports:
- "3000:3000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.account-client.rule=Host(`malcorp.test`) && PathPrefix(`/account`)"
volumes:
- ./account-client:/app
- /app/node_modules #avoid overwriting node_modules
depends_on:
- reverse-proxy
words:
build:
# build from build stage of dockerfile in words directory
context: ./words
target: builder
image: words # if we don't give image name, traefik won't create router 🤷♂️
expose:
- "8080" # seems necessary for Traefik to have internal expose of port
labels:
- "traefik.enable=true"
- "traefik.http.routers.words.rule=Host(`wordmem.test`) && PathPrefix(`/api/words`)"
volumes:
- ./words:/app
depends_on:
- postgres-words
environment:
- NODE_ENV=dev
command: [ "npm", "run", "dev" ]
word-client:
build:
context: ./word-client
image: word-client # if we don't give image name, traefik won't create router 🤷♂️
stdin_open: true # required with react-scripts > 3.4
expose:
- "3000"
ports:
- "3003:3000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.word-client.rule=Host(`wordmem.test`)"
volumes:
- ./word-client:/app
- /app/node_modules
volumes:
pgdata_account:
pgdata_words:
redisdata: