-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdocker-compose.yml
70 lines (65 loc) · 1.55 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
version: "3.9"
# Docker-compose 使用自定义网络
# 手动创建:docker network create custom-local-net --driver=bridge --subnet=192.168.100.0/24
# 查看列表:docker network ls
# 删除网络:docker network rm custom-local-net
# 查看详情:docker network inspect custom-local-net
networks:
custom-local-net:
driver: bridge
ipam:
config:
- subnet: 192.168.100.0/24
gateway: 192.168.100.1
# external:
# true
services:
db:
image: mysql:latest
container_name: mysql-db
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE: mydb
command:
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
ports:
- "3306:3306"
volumes:
- ./infrastructure/database/data.sql:/docker-entrypoint-initdb.d/data.sql
networks:
- custom-local-net
app:
build:
context: .
dockerfile: Dockerfile
working_dir: /app
image: go-ddd
container_name: go-app
restart: always
ports:
- "8080:8080"
environment:
- GO111MODULE=on
volumes:
- .:/go/src/app
depends_on:
- db
networks:
- custom-local-net
nginx:
image: nginx:latest
container_name: nginx-web
restart: always
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
depends_on:
- app
networks:
- custom-local-net