fix(stack): 其余4个模式同步 bind mount 兼容修复

与 docker-dev(commit 5797885)保持一致的修复方案:
- run.sh 改为 SCRIPT_DIR 自动检测脚本所在目录
- Dockerfile ENTRYPOINT/chmod 改为完整路径
  /var/www/html/source/stack/<mode>/source/docker/run.sh
- 基础配置(nginx.conf/zz-phprun.ini/zz-phpfpm.conf)复制到各模式目录
- ln -s 改为 ln -sf(防止容器重启时 File exists)

docker-dev-sync 额外保留 sync.sh 调用逻辑(init + watch),
仅路径改为 \/sync.sh
This commit is contained in:
augushong
2026-07-22 23:40:33 +08:00
parent 5797885f3d
commit 544604ebff
20 changed files with 300 additions and 28 deletions

View File

@@ -75,10 +75,11 @@ VOLUME /var/www/html/storage
# 暴露 Nginx 端口
EXPOSE 8000
RUN chmod +x /var/www/html/source/docker/run.sh
# B-route bind mount 模式ENTRYPOINT 必须用完整路径build 期 symlink 被 bind mount 覆盖)
RUN chmod +x /var/www/html/source/stack/full/source/docker/run.sh
# 启动 Nginx PHP 然后阻塞
ENTRYPOINT ["/bin/bash", "/var/www/html/source/docker/run.sh"]
ENTRYPOINT ["/bin/bash", "/var/www/html/source/stack/full/source/docker/run.sh"]
CMD ["server"]

View File

@@ -0,0 +1,30 @@
server {
listen 8000 default_server;
listen [::]:8000 default_server;
root /var/www/html/public;
index index.php index.html index.htm;
server_name _;
# 上传大小不限制
client_max_body_size 8192m;
# 运行时长不限制
fastcgi_read_timeout 60000;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

View File

@@ -1,12 +1,15 @@
#!/bin/bash
# 自动检测脚本所在目录B-route 兼容bind mount 下路径为 source/stack/<mode>/source/docker/
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 将代码中的nginx复制到nginx配置文件中
cp /var/www/html/source/docker/nginx.conf /etc/nginx/sites-available/default
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
cp "$SCRIPT_DIR/nginx.conf" /etc/nginx/sites-available/default
ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# 将代码中的php配置文件复制到php配置文件中
cp /var/www/html/source/docker/zz-phprun.ini /usr/local/etc/php/conf.d
cp /var/www/html/source/docker/zz-phpfpm.conf /usr/local/etc/php-fpm.d
cp "$SCRIPT_DIR/zz-phprun.ini" /usr/local/etc/php/conf.d
cp "$SCRIPT_DIR/zz-phpfpm.conf" /usr/local/php-fpm.d
# 设置目录权限,确保挂载卷后依然有效

View File

@@ -0,0 +1,8 @@
[www]
; 进程数不限制
pm = dynamic
pm.max_children = 150
pm.start_servers = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 30

View File

@@ -0,0 +1,26 @@
; 内存不限制
memory_limit = -1
; 上传文件大小不限制
upload_max_filesize = -1
; 运行时长不限制
max_execution_time = 0
; POST大小不限制
post_max_size = -1
; 设置时区
date.timezone = "Asia/Shanghai"
[Zend Opcache]
opcache.enable = 1
opcache.memory_consumption=128
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=80000
opcache.revalidate_freq=3
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.jit_buffer_size=128m
opcache.jit=1205