This commit is contained in:
2025-12-25 16:51:19 +08:00
parent 72f6b341a1
commit 46135002f9
2 changed files with 10 additions and 87 deletions

View File

@@ -86,41 +86,7 @@ EXPOSE 9000 8080
# 添加在Dockerfile末尾CMD命令之前
COPY ./entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# 设置环境变量来控制entrypoint行为
# 可以通过docker run -e 或docker-compose.yml覆盖这些值
# ENV PHP_APP_ROOT=/var/www/html \
# USER_ID=33 \
# GROUP_ID=33
# ========================================
# Dockerfile 配置选项说明
# ========================================
#
# 1. 默认行为(当前配置):
# - 使用 /var/www/html 作为应用根目录
# - 启动 supervisord
# - 适用于标准Web应用
#
# 2. 自定义应用根目录:
# 在docker run时覆盖环境变量
# docker run -e PHP_APP_ROOT=/custom/app php-app
#
# 3. 传递路径参数给entrypoint
# 修改ENTRYPOINT来包含路径
# ENTRYPOINT ["/usr/local/bin/entrypoint.sh", "/custom/path"]
# CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
#
# 4. 不同启动命令:
# 修改CMD来启动不同服务
# CMD ["php-fpm"] # 直接启动PHP-FPM
# CMD ["/bin/bash"] # 启动shell进行调试
# CMD ["apache2ctl", "-D", "FOREGROUND"] # 启动Apache
#
# ========================================
# 设置ENTRYPOINT注意这里不会带路径参数
# 路径可以通过环境变量PHP_APP_ROOT控制默认是/var/www/html
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# CMD会作为参数传递给entrypoint.sh
# 修改CMD命令
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]