-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
133 lines (130 loc) · 3.57 KB
/
docker-compose.yaml
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
services:
mysql-db:
image: mysql:latest
container_name: mysql-db
restart: always
volumes:
- my-db:/var/lib/mysql
environment:
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'password'
MYSQL_ROOT_PASSWORD: 'password'
ports:
- '3306:3306'
expose:
- '3306'
networks:
- backend_network
healthcheck:
test: ['CMD', 'mysql-db', '-h', '$MYSQL_HOST', '-u', '$MYSQL_USER', '-p$MYSQL_PASSWORD', '-e', 'SELECT 1']
timeout: 20s
retries: 10
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: backend
command: >
sh -c 'python3 manage.py makemigrations &&
python3 manage.py migrate --noinput &&
python3 manage.py collectstatic --noinput &&
python3 manage.py update_currencies &&
python3 manage.py update_stocks &&
python3 manage.py update_indices &&
python3 manage.py update_US_stocks &&
python3 manage.py generate_posts &&
gunicorn backend.wsgi:application --bind 0.0.0.0:8000'
restart: always
environment:
MYSQL_HOST: 'mysql-db'
MYSQL_DATABASE: 'db'
MYSQL_USER: 'user'
MYSQL_PASSWORD: 'password'
SECRET_KEY: 'django-insecure-wuc2#&nmhoqp7266)y639mfopdfwxzzx4jlux-f$k0c(+dhju*'
EMAIL_BACKEND: 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS: 'false'
EMAIL_HOST: 'mailhog'
EMAIL_PORT: '1025'
EMAIL_HOST_USER: 'test'
EMAIL_HOST_PASSWORD: 'test'
ANNOTATIONS_SERVICE_URL: "http://annotations-backend:8001"
BACKEND_SERVICE_URL: "http://0.0.0.0:8001"
volumes:
- ./backend:/backend
ports:
- '8000:8000'
depends_on:
- mysql-db
networks:
- backend_network
frontend:
image: frontend
build:
context: ./frontend
dockerfile: Dockerfile
args:
REACT_APP_API_BASE_URL: 'http://0.0.0.0:8000'
container_name: frontend
restart: always
ports:
- "3000:3000"
depends_on:
- backend
networks:
- backend_network
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025
- 8025:8025
restart: unless-stopped
networks:
- backend_network
annotations-db:
image: mysql:latest
container_name: annotations-db
restart: always
volumes:
- annotations-db:/var/lib/mysql
environment:
MYSQL_DATABASE: 'annotations_db'
MYSQL_USER: 'annotations_user'
MYSQL_PASSWORD: 'annotations_password'
MYSQL_ROOT_PASSWORD: 'annotations_password'
networks:
- backend_network
annotations-backend:
build:
context: ./annotations_project
container_name: annotations-backend
command: >
sh -c "python3 manage.py makemigrations &&
python3 manage.py migrate --noinput &&
python3 manage.py collectstatic --noinput &&
gunicorn annotations_project.wsgi:application --bind 0.0.0.0:8001"
restart: always
environment:
MYSQL_HOST: 'annotations-db'
MYSQL_DATABASE: 'annotations_db'
MYSQL_USER: 'annotations_user'
MYSQL_PASSWORD: 'annotations_password'
BACKEND_SERVICE_URL: "http://0.0.0.0:8001"
ports:
- "8001:8001"
depends_on:
- annotations-db
healthcheck:
test: ["CMD", "python3", "manage.py", "check"]
interval: 30s
timeout: 10s
retries: 5
networks:
- backend_network
networks:
backend_network:
driver: bridge
volumes:
my-db:
backend:
annotations-db: