From 4ad1844decdc62880ad75bcf24182082c0a034d6 Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Tue, 3 Mar 2026 19:33:02 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90docker=E3=80=91docs(docker):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0docker-compose=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加docker-compose.yml文件用于快速部署项目 添加vhost.conf作为nginx配置文件 添加README.md说明docker环境搭建和使用步骤 --- docker/README.md | 47 +++++++++++++++++++ docker/docker-compose.yml | 97 +++++++++++++++++++++++++++++++++++++++ docker/vhost.conf | 59 ++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml create mode 100644 docker/vhost.conf diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 000000000..8420a5f89 --- /dev/null +++ b/docker/README.md @@ -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 +``` + + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 000000000..465b3ae9c --- /dev/null +++ b/docker/docker-compose.yml @@ -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区间 \ No newline at end of file diff --git a/docker/vhost.conf b/docker/vhost.conf new file mode 100644 index 000000000..63b394560 --- /dev/null +++ b/docker/vhost.conf @@ -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; + } + + +} \ No newline at end of file