[#1] 构建镜像;USER root; 使用supervisor守护进程;端到端本地测试

This commit is contained in:
root
2025-09-15 09:59:49 +00:00
parent 653a0c04a6
commit 31a6ab9803
25 changed files with 559 additions and 209 deletions

View File

@@ -0,0 +1,33 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:8.13.4
# 切换到 root 用户进行系统级安装
USER root
# 安装 supervisor
RUN apt-get update && \
apt-get install -y supervisor && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# 创建 supervisor 日志目录
RUN mkdir -p /var/log/supervisor
# 复制 supervisor 配置文件
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# 复制启动脚本
COPY start-es-supervised.sh /usr/local/bin/start-es-supervised.sh
RUN chmod +x /usr/local/bin/start-es-supervised.sh
# 创建数据目录并设置权限
RUN mkdir -p /private/argus/log/elasticsearch && \
chown -R elasticsearch:elasticsearch /private/argus/log/elasticsearch
# 保持 root 用户,由 supervisor 管理用户切换
USER root
# 暴露端口
EXPOSE 9200 9300
# 使用 supervisor 作为入口点
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]