-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
64 lines (63 loc) · 1.37 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
version: '3.4'
services:
app:
# 会自动读取对应的Dockerfile
build: ./app
image: app
container_name: app
volumes: # For dev server to use our local files
- ./app:/usr/src/app
- usr/src/app/node_modules
ports:
- '3000:3000'
# restart: always
command:
"npm run dev"
api:
build: ./api
image: api
container_name: api
environment:
- DB_NAME=todolist
- DB_USER=root
- DB_PASSWORD=root
- DB_HOST=db
- DB_PORT=3306
- NODE_ENV=development
volumes:
- ./api:/usr/src/api
- /usr/src/api/node_modules
ports:
- '8080'
depends_on:
- "db"
command:
"npm run serve"
db:
build: ./sql
env_file:
- ./sql/mysql.env
image: db
container_name: db
environment:
- MYSQL_DATABASE=todolist
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=root
volumes:
- ./sql/db-data:/var/lib/mysql:rw
# command: mysqld
# --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci #设置utf8字符集
restart: always
ports:
- '3306:3306'
server:
build: ./nginx
image: server
container_name: server
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
links:
- app:app
- api:api
ports:
- '80:80' # Connect localhost 80 port to container 80 port