mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-08-30 12:45:32 +08:00
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:
@@ -28,9 +28,10 @@ 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/author/source/docker/run.sh
|
||||
|
||||
# 启动 Nginx PHP 然后阻塞
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/docker/run.sh"]
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/stack/author/source/docker/run.sh"]
|
||||
|
||||
CMD ["server"]
|
||||
|
||||
30
source/stack/author/source/docker/nginx.conf
Normal file
30
source/stack/author/source/docker/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
# 设置目录权限,确保挂载卷后依然有效
|
||||
|
||||
8
source/stack/author/source/docker/zz-phpfpm.conf
Normal file
8
source/stack/author/source/docker/zz-phpfpm.conf
Normal 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
|
||||
26
source/stack/author/source/docker/zz-phprun.ini
Normal file
26
source/stack/author/source/docker/zz-phprun.ini
Normal 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
|
||||
@@ -80,10 +80,11 @@ VOLUME /var/www/html/storage
|
||||
# Expose Nginx port
|
||||
EXPOSE 8000
|
||||
|
||||
RUN chmod +x /var/www/html/source/docker/sync.sh
|
||||
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/docker-dev-sync/source/docker/sync.sh
|
||||
RUN chmod +x /var/www/html/source/stack/docker-dev-sync/source/docker/run.sh
|
||||
|
||||
# Start Nginx and PHP-FPM
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/docker/run.sh"]
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/stack/docker-dev-sync/source/docker/run.sh"]
|
||||
|
||||
CMD ["server"]
|
||||
|
||||
30
source/stack/docker-dev-sync/source/docker/nginx.conf
Normal file
30
source/stack/docker-dev-sync/source/docker/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 自动检测脚本所在目录(B-route 兼容:bind mount 下路径为 source/stack/<mode>/source/docker/)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# ============================================
|
||||
# run.sh - docker-dev-sync entrypoint
|
||||
# ============================================
|
||||
@@ -14,11 +17,11 @@ echo "[run] Checking source mount..."
|
||||
|
||||
if [ -d "/var/www/source" ] && [ "$(ls -A /var/www/source 2>/dev/null)" ]; then
|
||||
echo "[run] Source directory mounted, performing initial sync..."
|
||||
/bin/bash /var/www/html/source/docker/sync.sh init
|
||||
/bin/bash "$SCRIPT_DIR/sync.sh" init
|
||||
echo "[run] Initial sync finished."
|
||||
|
||||
# Start background polling
|
||||
/bin/bash /var/www/html/source/docker/sync.sh watch &
|
||||
/bin/bash "$SCRIPT_DIR/sync.sh" watch &
|
||||
SYNC_PID=$!
|
||||
echo "[run] Background sync polling started (PID: ${SYNC_PID}, interval: ${SYNC_INTERVAL:-3}s)."
|
||||
else
|
||||
@@ -29,16 +32,16 @@ fi
|
||||
# ---- Step 2: Configure services ----
|
||||
|
||||
# Copy nginx config
|
||||
cp /var/www/html/source/docker/nginx.conf /etc/nginx/sites-available/default
|
||||
cp "$SCRIPT_DIR/nginx.conf" /etc/nginx/sites-available/default
|
||||
ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
|
||||
|
||||
# Copy php config files
|
||||
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
|
||||
|
||||
# Dev mode: override production PHP config (Opcache, error display, Xdebug)
|
||||
cp /var/www/html/source/docker/zzz-dev.ini /usr/local/etc/php/conf.d
|
||||
cp /var/www/html/source/docker/zzz-xdebug.ini /usr/local/etc/php/conf.d
|
||||
cp "$SCRIPT_DIR/zzz-dev.ini" /usr/local/etc/php/conf.d
|
||||
cp "$SCRIPT_DIR/zzz-xdebug.ini" /usr/local/etc/php/conf.d
|
||||
|
||||
# ---- Step 3: Set directory permissions ----
|
||||
mkdir -p /var/www/html/runtime && chmod -R 777 /var/www/html/runtime
|
||||
|
||||
@@ -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
|
||||
26
source/stack/docker-dev-sync/source/docker/zz-phprun.ini
Normal file
26
source/stack/docker-dev-sync/source/docker/zz-phprun.ini
Normal 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
|
||||
@@ -28,10 +28,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/docker-serve/source/docker/run.sh
|
||||
|
||||
# 启动 Nginx PHP 然后阻塞
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/docker/run.sh"]
|
||||
ENTRYPOINT ["/bin/bash", "/var/www/html/source/stack/docker-serve/source/docker/run.sh"]
|
||||
|
||||
CMD ["server"]
|
||||
|
||||
|
||||
30
source/stack/docker-serve/source/docker/nginx.conf
Normal file
30
source/stack/docker-serve/source/docker/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
# 设置目录权限,确保挂载卷后依然有效
|
||||
|
||||
8
source/stack/docker-serve/source/docker/zz-phpfpm.conf
Normal file
8
source/stack/docker-serve/source/docker/zz-phpfpm.conf
Normal 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
|
||||
26
source/stack/docker-serve/source/docker/zz-phprun.ini
Normal file
26
source/stack/docker-serve/source/docker/zz-phprun.ini
Normal 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
|
||||
@@ -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"]
|
||||
|
||||
|
||||
30
source/stack/full/source/docker/nginx.conf
Normal file
30
source/stack/full/source/docker/nginx.conf
Normal 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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
# 设置目录权限,确保挂载卷后依然有效
|
||||
|
||||
8
source/stack/full/source/docker/zz-phpfpm.conf
Normal file
8
source/stack/full/source/docker/zz-phpfpm.conf
Normal 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
|
||||
26
source/stack/full/source/docker/zz-phprun.ini
Normal file
26
source/stack/full/source/docker/zz-phprun.ini
Normal 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
|
||||
Reference in New Issue
Block a user