Files
ulthon_admin/source/stack/author/source/docker/run.sh
augushong 544604ebff 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
2026-07-22 23:40:33 +08:00

41 lines
1.6 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 自动检测脚本所在目录B-route 兼容bind mount 下路径为 source/stack/<mode>/source/docker/
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# 将代码中的nginx复制到nginx配置文件中
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 "$SCRIPT_DIR/zz-phprun.ini" /usr/local/etc/php/conf.d
cp "$SCRIPT_DIR/zz-phpfpm.conf" /usr/local/php-fpm.d
# 设置目录权限,确保挂载卷后依然有效
mkdir -p /var/www/html/runtime && chmod -R 777 /var/www/html/runtime
mkdir -p /var/www/html/public/storage && chmod -R 777 /var/www/html/public/storage
mkdir -p /var/www/html/public/build && chmod -R 777 /var/www/html/public/build
mkdir -p /var/www/html/storage && chmod -R 777 /var/www/html/storage
mkdir -p /var/www/html/memoryspace && chown -R www-data:www-data /var/www/html/memoryspace
# 运行redis
# nohup redis-server --requirepass "" &
# 输出参数
echo "参数为:$@"
# TODO增加自动批量运行并阻塞的脚本比如group default 会调用auto.sh的default的部分最终阻塞auth.sh的default部分可能会运行一系列的命令比如清空缓存踢人下线重置密码
if [ "$1" = "server" ] || [ "$1" = "" ]; then
# 运行定时任务 TODO:以指定用户运行
su - www-data -c "nohup php /var/www/html/think timer --local --quiet &"
# 运行nginx
service nginx start
# 运行php-fpm
php-fpm
else
php "/var/www/html/""$@"
fi