-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocker-compose.yml
137 lines (135 loc) · 3.74 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
version: "3.8"
networks:
creature-chess:
name: creature-chess
external: true
services:
# this is the base image for all nodejs-based apps
nodejs-builder:
build:
context: .
dockerfile: apps/nodejs-builder.Dockerfile
image: nodejs-builder
networks:
- creature-chess
# this image builds the web-game app
# TODO (James) we could extend this in local dev to also watch for changes
web-game-builder:
build:
context: .
dockerfile: apps/web-builder.Dockerfile
args:
- APP_DIR=web-game
environment:
- NODE_ENV
- AUTH0_ENABLED
- AUTH0_DOMAIN
- AUTH0_SPA_CLIENT_ID
- API_INFO_URL
- CREATURE_CHESS_APP_URL
- CREATURE_CHESS_IMAGE_URL
volumes:
# TODO (James) consider whether we should use an actual volume here
# rather than a bind mount
- ./dist/web-game:/code/apps/web-game/dist
depends_on:
nodejs-builder:
condition: service_completed_successfully
# this image builds the web-menu app
# TODO (James) we could extend this in local dev to also watch for changes
web-menu-builder:
build:
context: .
dockerfile: apps/web-builder.Dockerfile
args:
- APP_DIR=web-menu
environment:
- NODE_ENV
- AUTH0_ENABLED
- AUTH0_DOMAIN
- AUTH0_SPA_CLIENT_ID
- API_INFO_URL
- CREATURE_CHESS_APP_URL
- CREATURE_CHESS_IMAGE_URL
- GAME_SERVER_URL
volumes:
# TODO (James) consider whether we should use an actual volume here
# rather than a bind mount
- ./dist/web-menu:/code/apps/web-menu/dist
depends_on:
nodejs-builder:
condition: service_completed_successfully
# nginx is used to serve the web apps as well as proxy requests to the servers
# the web app contents are passed in the volumes
nginx:
build:
context: .
dockerfile: nginx/local-dev/Dockerfile
volumes:
- ./nginx/local-dev/nginx/error.log:/etc/nginx/error_log.log
- ./nginx/local-dev/nginx/access.log:/etc/nginx/access_log.log
- ./images:/usr/share/nginx/html/images # images e.g. ui and creatures
- ./dist/web-game:/usr/share/nginx/html/web-game # web-game app
- ./dist/web-menu:/usr/share/nginx/html/web-menu # web-menu app
ports:
- 80:80
- 443:443
networks:
- creature-chess
depends_on:
web-game-builder:
condition: service_completed_successfully
web-menu-builder:
condition: service_completed_successfully
server-game:
condition: service_started
server-info:
condition: service_started
# this is the nodejs websocket server for the game
server-game:
environment:
- AUTH0_DOMAIN
- AUTH0_SPA_CLIENT_ID
- AUTH0_MACHINE_TO_MACHINE_CLIENT_ID
- AUTH0_MANAGEMENT_CLIENT_SECRET
- CREATURE_CHESS_APP_URL
- API_INFO_URL
- CREATURE_CHESS_IMAGE_URL
- NODE_ENV
- DATABASE_URL
build:
context: .
dockerfile: apps/server.Dockerfile
args:
- APP_DIR=server-game
ports:
- "3000"
networks:
- creature-chess
restart: always
depends_on:
nodejs-builder:
condition: service_completed_successfully
# this is the API server
server-info:
environment:
- AUTH0_DOMAIN
- AUTH0_SPA_CLIENT_ID
- AUTH0_MACHINE_TO_MACHINE_CLIENT_ID
- AUTH0_MANAGEMENT_CLIENT_SECRET
- CREATURE_CHESS_APP_URL
- NODE_ENV
- DATABASE_URL
build:
context: .
dockerfile: apps/server.Dockerfile
args:
- APP_DIR=server-info
ports:
- "3000"
networks:
- creature-chess
restart: always
depends_on:
nodejs-builder:
condition: service_completed_successfully