43 lines
1.8 KiB
Docker
43 lines
1.8 KiB
Docker
FROM debian:bookworm
|
|
|
|
# 切换 Debian 镜像源为腾讯云源,更新包列表并安装依赖
|
|
RUN sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debian.sources \
|
|
&& apt update && apt upgrade -y \
|
|
&& apt install -y \
|
|
locales \
|
|
wget openssh-server cmake make gcc g++ autoconf sudo curl dos2unix build-essential \
|
|
&& apt clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 复制脚本
|
|
COPY ["bt.sh", "init_mysql.sh", "/"]
|
|
|
|
# 转换启动脚本
|
|
RUN dos2unix /bt.sh && dos2unix /init_mysql.sh
|
|
|
|
# 下载并安装宝塔面板及 lnmp 环境
|
|
RUN curl -sSO https://download.bt.cn/install/install_lts.sh \
|
|
&& echo y | bash install_lts.sh -P 8888 --ssl-disable \
|
|
&& btpip config set global.index-url https://mirrors.tencent.com/pypi/simple \
|
|
&& rm -rf /www/server/data/* \
|
|
&& echo "docker_bt_ltsd12" > /www/server/panel/data/o.pl \
|
|
&& echo '["memuA", "memuAsite", "memuAdatabase", "memuAcontrol", "memuAfiles", "memuAlogs", "memuAxterm", "memuAcrontab", "memuAsoft", "memuAconfig", "dologin", "memu_btwaf", "memuAssl"]' > /www/server/panel/config/show_menu.json \
|
|
&& apt clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& chmod +x /bt.sh \
|
|
&& chmod +x /init_mysql.sh
|
|
|
|
|
|
# 配置宝塔面板安全入口和用户名及密码,以及 SSH 密码
|
|
RUN echo btpanel | bt 6 \
|
|
&& echo btpaneldocker | bt 5 \
|
|
&& echo "/btpanel" > /www/server/panel/data/admin_path.pl \
|
|
&& echo "root:btpaneldocker" | chpasswd
|
|
|
|
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
|
|
|
|
# 暴漏特定端口
|
|
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 |