1 Star 0 Fork 75

nwtjacky/huasenjio-compose

forked from 花森/huasenjio-compose 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
docker-compose.yml 3.43 KB
一键复制 编辑 原始数据 按行查看 历史
花森 提交于 2023-07-31 22:35 . feat:兼容系统环境
# 版本号
version: "3"
# 自定义网络
networks:
# 网络名字
huasenNetwork:
# 网关驱动
driver: bridge
# 容器服务
services:
# 服务名称
mongo:
# 安装镜像
image: mongo:4.2.2
# 容器名称
container_name: mongo
volumes:
# /data/db数据目录挂载到宿主机
- ./huasen-mongo/volume:/data/db
# 记录终端输出
- ./huasen-mongo/tail/null:/huasen-mongo/tail/null
# init-mongo-open.js 文件会在 mongodb 容器初始化完成之后执行,创建数据库默认的角色
- ./huasen-mongo/init-mongo-open.js:/docker-entrypoint-initdb.d/init-mongo-open.js
# 执行命令,windows 系统下,设置 15 秒的睡眠时间,避免 mongo 没有启动,执行初始化脚本失败
command: sh -c "mongod --bind_ip 0.0.0.0 & sleep 15 && mongo /docker-entrypoint-initdb.d/init-mongo-open.js && tail -f /huasen-mongo/tail/null"
environment:
# 设置时区为上海(东八区)
TZ: Asia/Shanghai
# 初始化mongodb的账户,账户创建在admin下,拥有超管权限
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: Mongo12345*
ports:
# 将容器的27017端口映射到宿主机的27017端口
- 37017:27017
networks:
# 设置网络
- huasenNetwork
redis:
image: redis:6.0.10-alpine
container_name: redis
privileged: true
environment:
- TZ=Asia/Shanghai
ports:
- 7379:6379
# 挂载配置文件和数据
volumes:
- ./huasen-redis/conf/redis-open.conf:/usr/local/etc/redis/redis.conf
- ./huasen-redis/data:/data:rw
# 执行配置
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- huasenNetwork
nginx:
image: nginx:1.23.1
container_name: nginx
restart: always
volumes:
# 将容器中的nginx配置挂载到宿主机上对应的文件
- ./huasen-nginx/conf/nginx-open.conf:/etc/nginx/nginx.conf
- ./huasen-nginx/www:/home/www
- ./huasen-nginx/log:/var/log/nginx
- ./huasen-nginx/html:/usr/share/nginx/html
# 端口暴露
ports:
# - 80:80
- target: 80
published: 80
protocol: tcp
mode: host
environment:
- TZ=Asia/Shanghai
networks:
- huasenNetwork
jenkins:
image: jenkins/jenkins:lts
container_name: jenkins
privileged: true
user: root
volumes:
# 挂载目录到容器
- ./huasen-jenkins/:/var/jenkins_home
- ./huasen-jenkins-cache:/huasen-jenkins-cache
# 代理docker-compose到容器
- /usr/local/bin/docker-compose:/usr/local/bin/docker-compose
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- /usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7
ports:
- "8080:8080"
environment:
- TZ=Asia/Shanghai
networks:
- huasenNetwork
server:
# 指定Dockerflie构建镜像
build:
context: ./huasen-server
# 定义容器名称
container_name: server
privileged: true
user: root
# 代理日志文件
volumes:
- ./huasen-log/:/app/huasen-server/log
- ./huasen-store/:/app/huasen-store
- ./huasen-server/setting.json:/app/huasen-server/setting.json
ports:
- "3000:3000"
- "8181:8181"
environment:
- TZ=Asia/Shanghai
depends_on:
- mongo
- redis
networks:
- huasenNetwork
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/taor/huasenjio-compose.git
git@gitee.com:taor/huasenjio-compose.git
taor
huasenjio-compose
huasenjio-compose
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385