fix: 修复脚本换行符使用错误

This commit is contained in:
xiao 2024-11-02 09:14:34 +08:00
parent c879a8598d
commit 6b30b959f6
2 changed files with 54 additions and 51 deletions

View File

@ -1,47 +1,50 @@
FROM debian:bookworm FROM debian:bookworm
COPY bt.sh /bt.sh COPY bt.sh /bt.sh
# 设置构建参数 # 转换 bt.sh 文件的换行符
ARG RANDOM_NAME RUN dos2unix /bt.sh
# 设置一个btd12-前缀的随机主机名 # 设置构建参数
RUN echo "btd12-${RANDOM_NAME}" > /etc/hostname ARG RANDOM_NAME
# 更新包列表 # 设置一个btd12-前缀的随机主机名
RUN apt update RUN echo "btd12-${RANDOM_NAME}" > /etc/hostname
RUN apt upgrade -y
# 更新包列表
# 安装前置依赖 RUN apt update
RUN apt install -y wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \ RUN apt upgrade -y
libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl
# 安装前置依赖
# 下载并安装宝塔面板 RUN apt install -y wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \ libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl
&& echo y | bash install_panel.sh -P 8888 --ssl-disable
# 下载并安装宝塔面板
# 配置宝塔面板安全入口和用户名及密码 RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
RUN echo btpanel | bt 6 \ && echo y | bash install_panel.sh -P 8888 --ssl-disable
&& echo btpaneldocker | bt 5 \
&& echo "/btpanel" > /www/server/panel/data/admin_path.pl # 配置宝塔面板安全入口和用户名及密码
RUN echo btpanel | bt 6 \
# 设置 root 用户密码 && echo btpaneldocker | bt 5 \
RUN echo "root:btpaneldocker" | chpasswd && echo "/btpanel" > /www/server/panel/data/admin_path.pl
# 赋予 bt.sh 可执行权限 # 设置 root 用户密码
RUN chmod +x /bt.sh RUN echo "root:btpaneldocker" | chpasswd
# 清理缓存 # 赋予 bt.sh 可执行权限
RUN apt-get clean \ RUN chmod +x /bt.sh
&& rm -rf /var/lib/apt/lists/*
# 清理缓存
# 设置标识文件 RUN apt-get clean \
RUN echo "dk_lib_test_d12" > /www/server/panel/data/o.pl && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/bin/sh","-c","/bt.sh"] # 设置标识文件
RUN echo "dk_lib_test_d12" > /www/server/panel/data/o.pl
# 暴漏所有端口
EXPOSE 0-65535 ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
# 健康检查 # 暴漏所有端口
EXPOSE 0-65535
# 健康检查
HEALTHCHECK --interval=5s --timeout=3s CMD curl -i http://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 HEALTHCHECK --interval=5s --timeout=3s CMD curl -i http://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

10
bt.sh
View File

@ -1,5 +1,5 @@
/etc/init.d/bt restart /etc/init.d/bt restart
pkill crond pkill crond
/sbin/crond /sbin/crond
/usr/sbin/sshd -D & /usr/sbin/sshd -D &
tail -f /dev/null tail -f /dev/null