refactor: 优化 Dockerfile 以简化安装和配置过程
This commit is contained in:
parent
7f46e1d7a9
commit
33ed7d1791
57
Dockerfile
57
Dockerfile
@ -1,41 +1,30 @@
|
||||
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_panel.sh \
|
||||
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
||||
&& mkdir /lnmp \
|
||||
&& curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh \
|
||||
&& bash /lnmp/nginx.sh install 1.27 \
|
||||
&& rm -rf /lnmp \
|
||||
&& rm -rf /www/server/nginx/src \
|
||||
&& echo "docker_bt_nas" > /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
|
||||
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 && \
|
||||
dos2unix /bt.sh && dos2unix /init_mysql.sh && \
|
||||
curl -sSO https://download.bt.cn/install/install_panel.sh && \
|
||||
echo y | bash install_panel.sh -P 8888 --ssl-disable && \
|
||||
mkdir /lnmp && \
|
||||
curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh && \
|
||||
bash /lnmp/nginx.sh install 1.27 && \
|
||||
rm -rf /lnmp && \
|
||||
rm -rf /www/server/nginx/src && \
|
||||
echo "docker_bt_nas" > /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 && \
|
||||
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"]
|
||||
|
||||
|
@ -1,41 +1,30 @@
|
||||
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_panel.sh \
|
||||
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
||||
&& mkdir /lnmp \
|
||||
&& curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh \
|
||||
&& bash /lnmp/nginx.sh install openresty \
|
||||
&& rm -rf /lnmp \
|
||||
&& rm -rf /www/server/nginx/src \
|
||||
&& echo "docker_bt_nas" > /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
|
||||
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 && \
|
||||
dos2unix /bt.sh && dos2unix /init_mysql.sh && \
|
||||
curl -sSO https://download.bt.cn/install/install_panel.sh && \
|
||||
echo y | bash install_panel.sh -P 8888 --ssl-disable && \
|
||||
mkdir /lnmp && \
|
||||
curl -o /lnmp/nginx.sh https://download.bt.cn/install/3/nginx.sh && \
|
||||
bash /lnmp/nginx.sh install openresty && \
|
||||
rm -rf /lnmp && \
|
||||
rm -rf /www/server/nginx/src && \
|
||||
echo "docker_bt_nas" > /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 && \
|
||||
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"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user