-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
47 lines (44 loc) · 1.32 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
services:
server:
build: ./server
ports:
- '8001:8001'
environment:
- DB_HOST=mysql
- DB_USER=ali
- DB_PASSWORD=root
- DB_NAME=crudmysql
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
command: ["./wait-for-it.sh", "mysql:3306", "--", "nodemon", "app.js"]
# React frontend service
client:
build: ./client
ports:
- '3000:3000'
depends_on:
- server
restart: unless-stopped
# MySQL service
mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: crudmysql
MYSQL_USER: ali
MYSQL_PASSWORD: root
ports:
- '3333:3306'
volumes:
- mysql-data:/var/lib/mysql
- ./initdb/init.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 10s
retries: 7
restart: unless-stopped
volumes:
mysql-data: