chore: 优化entrypoint.sh 去掉带参数设置
This commit is contained in:
@@ -86,7 +86,41 @@ 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命令
|
||||
# CMD会作为参数传递给entrypoint.sh
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||
Reference in New Issue
Block a user