Files
ulthon_admin/source/stack/default/docker/run.sh
augushong efc335e78f
All checks were successful
build-and-deploy / 直传代码并部署到 Host15 (push) Successful in 1m13s
feat(stack): 新增 docker-dev 开发模式并自动清理文件
- 新增 docker-dev 部署模式,提供包含 nginx+php-fpm、MySQL、Redis、phpMyAdmin 和 Xdebug 的完整 Docker 开发环境
- 在 StackModeService 中重写 applyMode 方法,切换模式时自动删除目标模式中不存在的已管理文件
- 新增 .docker-dev.env 配置文件并纳入 managed_files 管理,切换模式时自动复制或删除
2026-04-30 22:38:22 +08:00

38 lines
1.4 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
# 将代码中的nginx复制到nginx配置文件中
cp /var/www/html/docker/nginx.conf /etc/nginx/sites-available/default
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
# 将代码中的php配置文件复制到php配置文件中
cp /var/www/html/docker/zz-phprun.ini /usr/local/etc/php/conf.d
cp /var/www/html/docker/zz-phpfpm.conf /usr/local/etc/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 --quit &"
# 运行nginx
service nginx start
# 运行php-fpm
php-fpm
else
php "/var/www/html/""$@"
fi