-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
67 lines (63 loc) · 1.67 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
version: '3'
services:
nest-admin-web:
image: buqiyuan/vue3-antd-admin:stable
container_name: nest-admin-web
volumes:
- ./deploy/web:/etc/nginx/conf.d
ports:
- '80:80'
restart: always
networks:
- nest_admin_net
mysql:
image: mysql:latest
container_name: nest-admin-mysql
restart: always
env_file:
- .env
- .env.production
ports:
- '${MYSQL_PORT}:3306'
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci #设置utf8字符集
volumes:
- ./__data/mysql/:/var/lib/mysql/ # ./__data/mysql/ 路径可以替换成自己的路径
- ./deploy/sql/:/docker-entrypoint-initdb.d/ # 初始化的脚本,若 ./__data/mysql/ 文件夹存在数据,则不会执行初始化脚本
networks:
- nest_admin_net
redis:
image: redis:alpine
container_name: nest-admin-redis
restart: always
env_file:
- .env
- .env.production
ports:
- '${REDIS_PORT}:6379'
command: >
--requirepass ${REDIS_PASSWORD}
networks:
- nest_admin_net
nest-admin-server:
# build: 从当前路径构建镜像
build: .
image: buqiyuan/nest-admin-server:stable
container_name: nest-admin-server
restart: always
env_file:
- .env
- .env.production
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${SERVER_PORT}:${SERVER_PORT}'
- '${WS_PORT}:${WS_PORT}'
# 当前服务启动之前先要把depends_on指定的服务启动起来才行
depends_on:
- mysql
- redis
networks:
- nest_admin_net
networks:
nest_admin_net:
name: nest_admin_net