【docker】docs(docker): 添加docker-compose配置和相关文档

添加docker-compose.yml文件用于快速部署项目
添加vhost.conf作为nginx配置文件
添加README.md说明docker环境搭建和使用步骤
This commit is contained in:
sugar1569 2026-03-03 19:33:02 +08:00
parent 1791a3a387
commit 4ad1844dec
3 changed files with 203 additions and 0 deletions

47
docker/README.md Normal file
View File

@ -0,0 +1,47 @@
# docker-compose 快速运行项目
## 1、安装docker
docker 官网下载
https://www.docker.com/products/docker-desktop
或命令安装
```
curl -sSL https://get.daocloud.io/docker | sh
```
## 2、安装docker-compose
https://www.runoob.com/docker/docker-compose.html
## 3、下载CRMEB程序
建议去下载最新开源代码 https://gitee.com/ZhongBangKeJi/CRMEB
程序放到docker 同级目录下
## 4、启动项目
```
进入docker-compose目录 cd /docker
运行命令:
```
docker-compose up -d
```
## 5、访问CRMEB 系统
移动端访问地址:http://localhost:8011/
PC端访问地址:http://localhost:8011/admin
## 6、安装CRMEB
### Mysql数据库信息:
```
Host:crmeb_mysql
Post:3306
user:crmeb
pwd:123456
```
### Redis信息:
```
Host:crmeb_redis
Post:6379
db:0
pwd:123456
```

97
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,97 @@
services:
# mysql 容器
mysql:
container_name: crmeb_mysql
image: ccr.ccs.tencentyun.com/crmebmysql/mysql57:latest
platform: linux/arm64
ports:
- "33061:3306"
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 123456
MYSQL_USER: crmeb
MYSQL_PASSWORD: 123456
MYSQL_DATABASE: crmeb
volumes:
# - ./mysql/my.cnf:/etc/mysql/my.cnf
- ./mysql/data:/var/lib/mysql #挂载数据目录到本地
- ./mysql/log:/var/log/mysql
networks:
app_net:
ipv4_address: 192.168.10.11
# redis 容器
redis:
container_name: crmeb_redis
image: ccr.ccs.tencentyun.com/crmebredis/redis:latest
platform: linux/arm64
ports:
- "63791:6379"
environment:
TZ: Asia/Shanghai
REDIS_PASSWORD: 123456
networks:
app_net:
ipv4_address: 192.168.10.10
# php 容器
phpfpm:
container_name: crmeb_php
image: ccr.ccs.tencentyun.com/crmebphp/crmebky:latest
restart: always
environment:
TZ: Asia/Shanghai
# 数据库配置环境变量
MYSQL_HOST_IP: crmeb_mysql
MYSQL_PORT: "3306"
MYSQL_USER: crmeb
MYSQL_PASSWORD: 123456
MYSQL_DATABASE: crmeb
# Redis配置环境变量
REDIS_HOST_IP: crmeb_redis
REDIS_PORT: "6379"
REDIS_DATABASE: "0"
REDIS_PASSWORD: 123456
# 应用配置环境变量
APP_DEBUG: true
DEFAULT_TIMEZONE: Asia/Shanghai
ports:
- "9000:9000"
- "40001:40001"
- "40002:40002"
- "40003:40003"
# tmpfs: /var/temp #上传临时文件夹
working_dir: /var/www
volumes:
- ../crmeb:/var/www #程序运行目录
- ../crmeb/runtime:/var/www/runtime #程序运行时目录
networks:
app_net:
ipv4_address: 192.168.10.90
# nginx 容器
nginx:
container_name: crmeb_nginx
image: ccr.ccs.tencentyun.com/crmebnginx/nginx:latest
platform: linux/arm64
restart: always
ports:
- "8011:80"
# 依赖关系 先跑php
depends_on:
- phpfpm
environment:
TZ: Asia/Shanghai
working_dir: /var/www
volumes_from:
- phpfpm #继承phpfpm挂载目录
volumes:
- ./vhost.conf:/etc/nginx/conf.d/default.conf
- ./nginx/log:/etc/nginx/log
networks:
app_net:
ipv4_address: 192.168.10.80
networks: #网络配置
app_net: #网络名称
driver: bridge
ipam: #网络配置
driver: default
config:
- subnet: 192.168.10.0/24 #IP区间

59
docker/vhost.conf Normal file
View File

@ -0,0 +1,59 @@
server {
listen 80;
index index.php index.html;
server_name bz.crmeb.com;
client_max_body_size 100M;
root /var/www/public;
location / {
# try_files $uri /index.php$is_args$args;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log off;
access_log /dev/null;
}
location /notice {
proxy_pass http://192.168.10.90:40001/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /msg {
proxy_pass http://192.168.10.90:40002/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}