refactor: 更新 Dockerfile 以使用更小的基础镜像并暴露特定端口

This commit is contained in:
xiao 2024-12-21 09:17:17 +08:00 committed by cnb
parent 2a1994a6dc
commit 6495238639

View File

@ -1,4 +1,4 @@
FROM debian:bookworm
FROM debian:bookworm-slim
# 切换 Debian 镜像源为腾讯云源,更新包列表并安装依赖
RUN sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources \
@ -16,7 +16,7 @@ COPY ["bt.sh", "init_mysql.sh", "/"]
# 转换启动脚本
RUN dos2unix /bt.sh && dos2unix /init_mysql.sh
# 下载并安装宝塔面板及 lnmp 环境
# 下载并安装宝塔面板及 nginx
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
&& mkdir /lnmp \
@ -40,8 +40,8 @@ RUN echo btpanel | bt 6 \
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
# 暴漏所有端口
EXPOSE 0-65535
# 暴漏特定端口
EXPOSE 22 80 443 888 3306 8888
# 健康检查
HEALTHCHECK --interval=5s --timeout=3s CMD prot="http"; if [ -f "/www/server/panel/data/ssl.pl" ]; then prot="https"; fi; curl -k -i $prot://127.0.0.1:$(cat /www/server/panel/data/port.pl)$(cat /www/server/panel/data/admin_path.pl) | grep -E '(200|404)' || exit 1