chore(docker): 增加支持websocket转发功能,PHP容器不暴漏端口到主机
This commit is contained in:
@@ -54,15 +54,15 @@ RUN composer --version
|
||||
|
||||
# 修改 PHP 配置
|
||||
RUN echo "memory_limit=256M" > /usr/local/etc/php/conf.d/memory-limit.ini \
|
||||
&& echo "upload_max_filesize=50M" >> /usr/local/etc/php/conf.d/uploads.ini \
|
||||
&& echo "post_max_size=50M" >> /usr/local/etc/php/conf.d/uploads.ini
|
||||
&& echo "upload_max_filesize=150M" >> /usr/local/etc/php/conf.d/uploads.ini \
|
||||
&& echo "post_max_size=150M" >> /usr/local/etc/php/conf.d/uploads.ini
|
||||
|
||||
# # 使用Composer安装项目依赖(可选,根据需要启用, 更多的时候,会出错,要在容器中执行操作)
|
||||
# RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
|
||||
# RUN composer install --no-dev --optimize-autoloader --working-dir=/var/www/html
|
||||
|
||||
# 暴露端口
|
||||
EXPOSE 9000
|
||||
# 暴露端口,9000 为 PHP-FPM 端口,8080 为 WebSocket 端口
|
||||
EXPOSE 9000 8080
|
||||
|
||||
############ 查看 cron 进程
|
||||
## 查看 cron 进程
|
||||
|
||||
@@ -6,12 +6,14 @@ logfile_backups=10
|
||||
loglevel=info
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:chmod]
|
||||
command=/bin/bash -c "while true; do chmod -R 775 /var/www/html/runtime/ /var/www/html/upload/ 2>/dev/null || true; sleep 30; done"
|
||||
[program:php-permission-change]
|
||||
command=/bin/bash -c "sleep 15 && /usr/local/bin/entrypoint.sh"
|
||||
autostart=true
|
||||
autorestart=true
|
||||
stopasgroup=true
|
||||
stopasgroup=true
|
||||
killasgroup=true
|
||||
stdout_logfile=/var/log/supervisor/php-permission-change.log
|
||||
stderr_logfile=/var/log/supervisor/php-permission-change-error.log
|
||||
|
||||
[program:php-fpm]
|
||||
command=php-fpm
|
||||
@@ -42,4 +44,19 @@ stderr_logfile=/var/log/supervisor/think-cron-error.log
|
||||
stderr_logfile_maxbytes=10MB
|
||||
stderr_logfile_backups=10
|
||||
startsecs=3
|
||||
stopwaitsecs=10
|
||||
stopwaitsecs=10
|
||||
|
||||
[program:websocket-server]
|
||||
command=php src/ws_server.php
|
||||
workdir=/var/www/html
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=3
|
||||
stdout_logfile=/var/log/supervisor/websocket-server.log
|
||||
stdout_logfile_maxbytes=10MB
|
||||
stdout_logfile_backups=10
|
||||
stderr_logfile=/var/log/supervisor/websocket-server-error.log
|
||||
stderr_logfile_maxbytes=10MB
|
||||
stderr_logfile_backups=10
|
||||
startsecs=3
|
||||
stopwaitsecs=10
|
||||
|
||||
Reference in New Issue
Block a user