69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
version: '3'
|
|
|
|
# 申明同一个网络
|
|
networks:
|
|
net:
|
|
name: net
|
|
|
|
# 游戏数据卷
|
|
volumes:
|
|
consuldata:
|
|
name: consuldata
|
|
redisdata:
|
|
name: redisdata
|
|
mongodata:
|
|
name: mongodata
|
|
# 服务
|
|
services:
|
|
mongodb:
|
|
image: mongo:latest
|
|
container_name: mongodb
|
|
restart: unless-stopped
|
|
networks:
|
|
net:
|
|
ports:
|
|
- 27017:27017
|
|
volumes:
|
|
- ./mongodb/mongod.conf:/etc/mongo/mongod.conf:rw
|
|
- ./mongodb/initdb.d/:/docker-entrypoint-initdb.d/ #设置容器启动脚本
|
|
- mongodata:/data/db
|
|
environment:
|
|
- MONGO_INITDB_ROOT_USERNAME=root
|
|
- MONGO_INITDB_ROOT_PASSWORD=nicetoo1997
|
|
- MONGO_INITDB_DATABASE=admin
|
|
redis:
|
|
image: redis:latest
|
|
container_name: redis
|
|
restart: unless-stopped
|
|
networks:
|
|
net:
|
|
ports:
|
|
- '6379:6379'
|
|
command: /etc/redis/redis.conf
|
|
volumes:
|
|
# 持久存储redis的数据
|
|
- redisdata:/data
|
|
# 挂载本地配置文件
|
|
- ./redis.conf:/etc/redis/redis.conf
|
|
consul:
|
|
image: consul:1.10.0
|
|
container_name: consul
|
|
restart: unless-stopped
|
|
networks:
|
|
net:
|
|
ports:
|
|
- '8500:8500'
|
|
command: consul agent -server -bootstrap -data-dir /consul/data -node=ylconsul -bind=0.0.0.0 -config-dir=/consul/config/ -client=0.0.0.0 -ui
|
|
volumes:
|
|
- consuldata:/consul/data
|
|
go_dreamfactory:
|
|
image: golang:alpine
|
|
container_name: dreamfactory
|
|
networks:
|
|
net:
|
|
ports:
|
|
- 7891:7891
|
|
volumes:
|
|
- ./:/usr/local/dreamfactory
|
|
working_dir: /usr/local/dreamfactory
|
|
entrypoint: ["./entrypoint.sh"] |