-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
91 lines (84 loc) · 2.39 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
version: "3"
services:
mysql:
image: mysql:latest
restart: always
environment:
MYSQL_ROOT_PASSWORD: <MYSQL_PASSWORD> # replace this
MYSQL_DATABASE: <MYSQL_DATABASE_NAME> # replace this
MYSQL_PASSWORD: <MYSQL_PASSWORD> # replace this
expose:
- 3306
volumes:
- mysql_data:/var/lib/mysql
networks:
- main
redis_host:
image: redis:latest
restart: always
expose:
- 6379
volumes:
- redis_data:/data
networks:
- main
flask_app:
build: ./backend
expose:
- 5000
links:
- mysql:mysql
- redis_host:redis_host
depends_on:
- mysql
- redis_host
environment:
SECRET_KEY: <SECRET_KEY> # replace this
MYSQL_HOST: mysql # Use the service name as the host
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: <MYSQL_PASSWORD> # replace this
MYSQL_ADMIN_ACCOUNT: adminAccount
MYSQL_ADMIN_PASSWORD: <ADMIN_ACCOUNT_PASSWORD> # replace this and admin account password in init script
MYSQL_STAFF_ACCOUNT: staffAccount
MYSQL_STAFF_PASSWORD: <STAFF_ACCOUNT_PASSWORD> # replace this and staff account password in init script
MYSQL_REGISTERED_USER_ACCOUNT: registeredUserAccount
MYSQL_REGISTERED_USER_PASSWORD: <REGISTERED_USER_ACCOUNT_PASSWORD> # replace this and registered user account password in init script
MYSQL_GUEST_USER_ACCOUNT: guestAccount
MYSQL_GUEST_USER_PASSWORD: <GUEST_ACCOUNT_PASSWORD> # replace this and guest user account password in init script
MYSQL_DB: <MYSQL_DATABASE_NAME> # replace this
REDIS_HOST: redis_host # Use the service name as the host
REDIS_PORT: 6379
INIT_ENABLED: 1
networks:
- main
react_app:
build: ./frontend
expose:
- 3000
depends_on:
- flask_app
environment:
REACT_APP_BACKEND_API_URL: http://localhost/api # Communication will be done not within container network but through host network. So use localhost instead of service name.
networks:
- main
nginx:
image: nginx:latest
ports:
- "80:80"
links:
- flask_app:flask_app
- react_app:react_app
depends_on:
- flask_app
- react_app
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
networks:
- main
networks:
main:
driver: bridge
volumes:
mysql_data:
redis_data: