Update Docker image tags and build process for NAS support
This commit is contained in:
parent
058032aaac
commit
3f9c6bf406
152
.cnb.yml
152
.cnb.yml
@ -5,85 +5,85 @@ $:
|
|||||||
docker:
|
docker:
|
||||||
build:
|
build:
|
||||||
dockerfile: .ide/Dockerfile
|
dockerfile: .ide/Dockerfile
|
||||||
push:
|
# push:
|
||||||
- runner:
|
# - runner:
|
||||||
tags: cnb:arch:amd64
|
# tags: cnb:arch:amd64
|
||||||
services:
|
# services:
|
||||||
- docker
|
# - docker
|
||||||
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
# env:
|
||||||
IMAGE_TAG: btpanel/baota:latest-linux-amd64
|
# IMAGE_TAG: btpanel/baota:nas-linux-amd64
|
||||||
stages:
|
# stages:
|
||||||
- name: docker login
|
# - name: docker login
|
||||||
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
# script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
||||||
- name: docker build
|
# - name: docker build
|
||||||
script: docker build -t ${IMAGE_TAG} .
|
# script: docker build -t ${IMAGE_TAG} .
|
||||||
- name: docker push
|
# - name: docker push
|
||||||
script: docker push ${IMAGE_TAG}
|
# script: docker push ${IMAGE_TAG}
|
||||||
- name: resolve
|
# - name: resolve
|
||||||
type: cnb:resolve
|
# type: cnb:resolve
|
||||||
options:
|
# options:
|
||||||
key: build-amd64
|
# key: build-amd64
|
||||||
|
|
||||||
- runner:
|
# - runner:
|
||||||
tags: cnb:arch:arm64:v8
|
# tags: cnb:arch:arm64:v8
|
||||||
services:
|
# services:
|
||||||
- docker
|
# - docker
|
||||||
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
# env:
|
||||||
IMAGE_TAG: btpanel/baota:latest-linux-arm64
|
# IMAGE_TAG: btpanel/baota:nas-linux-arm64
|
||||||
stages:
|
# stages:
|
||||||
- name: docker login
|
# - name: docker login
|
||||||
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
# script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
|
||||||
- name: docker build
|
# - name: docker build
|
||||||
script: docker build -t ${IMAGE_TAG} .
|
# script: docker build -t ${IMAGE_TAG} -f ./arm64/Dockerfile ./arm64
|
||||||
- name: docker push
|
# - name: docker push
|
||||||
script: docker push ${IMAGE_TAG}
|
# script: docker push ${IMAGE_TAG}
|
||||||
- name: resolve
|
# - name: resolve
|
||||||
type: cnb:resolve
|
# type: cnb:resolve
|
||||||
options:
|
# options:
|
||||||
key: build-arm64
|
# key: build-arm64
|
||||||
|
|
||||||
- services:
|
# - services:
|
||||||
- docker
|
# - docker
|
||||||
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
|
||||||
env:
|
# env:
|
||||||
IMAGE_TAG: btpanel/baota:latest
|
# IMAGE_TAG: btpanel/baota:nas
|
||||||
stages:
|
# stages:
|
||||||
- name: await the amd64
|
# - name: await the amd64
|
||||||
type: cnb:await
|
# type: cnb:await
|
||||||
options:
|
# options:
|
||||||
key: build-amd64
|
# key: build-amd64
|
||||||
- name: await the arm64
|
# - name: await the arm64
|
||||||
type: cnb:await
|
# type: cnb:await
|
||||||
options:
|
# options:
|
||||||
key: build-arm64
|
# key: build-arm64
|
||||||
- name: manifest
|
# - name: manifest
|
||||||
image: cnbcool/manifest
|
# image: cnbcool/manifest
|
||||||
settings:
|
# settings:
|
||||||
username: $DOCKER_USERNAME
|
# username: $DOCKER_USERNAME
|
||||||
password: $DOCKER_PASSWD
|
# password: $DOCKER_PASSWD
|
||||||
target: ${IMAGE_TAG}
|
# target: ${IMAGE_TAG}
|
||||||
template: ${IMAGE_TAG}-OS-ARCH
|
# template: ${IMAGE_TAG}-OS-ARCH
|
||||||
platforms:
|
# platforms:
|
||||||
- linux/amd64
|
# - linux/amd64
|
||||||
- linux/arm64
|
# - linux/arm64
|
||||||
- name: clear
|
# - name: clear
|
||||||
image: lumir/remove-dockerhub-tag
|
# image: lumir/remove-dockerhub-tag
|
||||||
args:
|
# args:
|
||||||
- --user
|
# - --user
|
||||||
- $DOCKER_USERNAME
|
# - $DOCKER_USERNAME
|
||||||
- --password
|
# - --password
|
||||||
- $DOCKER_PASSWD
|
# - $DOCKER_PASSWD
|
||||||
- ${IMAGE_TAG}-linux-amd64
|
# - ${IMAGE_TAG}-linux-amd64
|
||||||
- ${IMAGE_TAG}-linux-arm64
|
# - ${IMAGE_TAG}-linux-arm64
|
||||||
|
|
||||||
- runner:
|
- runner:
|
||||||
tags: cnb:arch:amd64
|
tags: cnb:arch:amd64
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest-linux-amd64
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:nas-linux-amd64
|
||||||
stages:
|
stages:
|
||||||
- name: docker login
|
- name: docker login
|
||||||
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
||||||
@ -101,12 +101,12 @@ $:
|
|||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest-linux-arm64
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:nas-linux-arm64
|
||||||
stages:
|
stages:
|
||||||
- name: docker login
|
- name: docker login
|
||||||
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
script: docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY}
|
||||||
- name: docker build
|
- name: docker build
|
||||||
script: docker build -t ${IMAGE_TAG} .
|
script: docker build -t ${IMAGE_TAG} -f ./arm64/Dockerfile ./arm64
|
||||||
- name: docker push
|
- name: docker push
|
||||||
script: docker push ${IMAGE_TAG}
|
script: docker push ${IMAGE_TAG}
|
||||||
- name: resolve
|
- name: resolve
|
||||||
@ -120,7 +120,7 @@ $:
|
|||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
env:
|
env:
|
||||||
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:latest
|
IMAGE_TAG: ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:nas
|
||||||
stages:
|
stages:
|
||||||
- name: await the amd64
|
- name: await the amd64
|
||||||
type: cnb:await
|
type: cnb:await
|
||||||
@ -145,6 +145,6 @@ $:
|
|||||||
options:
|
options:
|
||||||
name: ${CNB_REPO_NAME}
|
name: ${CNB_REPO_NAME}
|
||||||
tags:
|
tags:
|
||||||
- latest-linux-amd64
|
- nas-linux-amd64
|
||||||
- latest-linux-arm64
|
- nas-linux-arm64
|
||||||
type: docker
|
type: docker
|
16
Dockerfile
16
Dockerfile
@ -5,13 +5,7 @@ RUN sed -i 's/deb.debian.org/mirrors.tencent.com/g' /etc/apt/sources.list.d/debi
|
|||||||
&& apt update && apt upgrade -y \
|
&& apt update && apt upgrade -y \
|
||||||
&& apt install -y \
|
&& apt install -y \
|
||||||
locales \
|
locales \
|
||||||
wget iproute2 openssh-server libgd-dev cmake make gcc g++ autoconf \
|
wget openssh-server cmake make gcc g++ autoconf sudo curl dos2unix build-essential \
|
||||||
libsodium-dev libonig-dev libssh2-1-dev libc-ares-dev libaio-dev sudo curl dos2unix \
|
|
||||||
build-essential re2c cron bzip2 libzip-dev libc6-dev bison file rcconf flex vim m4 gawk less cpp binutils \
|
|
||||||
diffutils unzip tar libbz2-dev libncurses5 libncurses5-dev libtool libevent-dev libssl-dev libsasl2-dev \
|
|
||||||
libltdl-dev zlib1g-dev libglib2.0-0 libglib2.0-dev libkrb5-dev libpq-dev libpq5 gettext libcap-dev \
|
|
||||||
libc-client2007e-dev psmisc patch git e2fsprogs libxslt1-dev xz-utils libgd3 libwebp-dev libvpx-dev \
|
|
||||||
libfreetype6-dev libjpeg62-turbo libjpeg62-turbo-dev iptables libudev-dev libldap2-dev \
|
|
||||||
&& apt clean \
|
&& apt clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@ -24,8 +18,12 @@ RUN dos2unix /bt.sh && dos2unix /init_mysql.sh
|
|||||||
# 下载并安装宝塔面板及 lnmp 环境
|
# 下载并安装宝塔面板及 lnmp 环境
|
||||||
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
|
RUN curl -sSO https://download.bt.cn/install/install_panel.sh \
|
||||||
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
&& echo y | bash install_panel.sh -P 8888 --ssl-disable \
|
||||||
&& rm -rf /www/server/data/* \
|
&& mkdir /lnmp \
|
||||||
&& echo "docker_bt_d12" > /www/server/panel/data/o.pl \
|
&& 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 \
|
&& echo '["memuA", "memuAsite", "memuAdatabase", "memuAcontrol", "memuAfiles", "memuAlogs", "memuAxterm", "memuAcrontab", "memuAsoft", "memuAconfig", "dologin", "memu_btwaf", "memuAssl"]' > /www/server/panel/config/show_menu.json \
|
||||||
&& apt clean \
|
&& apt clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
46
arm64/Dockerfile
Normal file
46
arm64/Dockerfile
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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
|
||||||
|
|
||||||
|
ENTRYPOINT ["/bin/sh","-c","/bt.sh"]
|
||||||
|
|
||||||
|
# 暴漏所有端口
|
||||||
|
EXPOSE 0-65535
|
||||||
|
|
||||||
|
# 健康检查
|
||||||
|
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
|
76
arm64/bt.sh
Normal file
76
arm64/bt.sh
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
init_path=/etc/init.d
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
O_pl=$(cat /www/server/panel/data/o.pl)
|
||||||
|
|
||||||
|
soft_start(){
|
||||||
|
# 扫描并启动所有服务
|
||||||
|
init_scripts=$(ls ${init_path})
|
||||||
|
for script in ${init_scripts}; do
|
||||||
|
case "${script}" in
|
||||||
|
"bt"|"mysqld"|"nginx"|"httpd")
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
${init_path}/${script} start
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -f ${init_path}/nginx ]; then
|
||||||
|
${init_path}/nginx start
|
||||||
|
elif [ -f ${init_path}/httpd ]; then
|
||||||
|
${init_path}/httpd start
|
||||||
|
fi
|
||||||
|
|
||||||
|
${init_path}/bt stop
|
||||||
|
${init_path}/bt start
|
||||||
|
|
||||||
|
pkill crond
|
||||||
|
/sbin/crond
|
||||||
|
|
||||||
|
chmod 600 /etc/ssh/ssh_host_*
|
||||||
|
/usr/sbin/sshd -D &
|
||||||
|
}
|
||||||
|
|
||||||
|
init_mysql(){
|
||||||
|
if [ "${O_pl}" != "docker_btlamp_nas" ] && [ "${O_pl}" != "docker_btlnmp_nas" ];then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
echo "check_z:"
|
||||||
|
echo ${check_z}
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
echo "check_z is not empty"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ -f /init_mysql.sh ] && [ -d "${Setup_Path}" ];then
|
||||||
|
bash /init_mysql.sh
|
||||||
|
rm -f /init_mysql.sh
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_empty_Data(){
|
||||||
|
return "$(ls -A ${Data_Path}/|wc -w)"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_mysql(){
|
||||||
|
if [ -d "${Setup_Path}" ] && [ -f "${init_path}/mysqld" ];then
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
${init_path}/mysqld start
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
is_empty_Data > /dev/null
|
||||||
|
init_mysql > /dev/null
|
||||||
|
start_mysql > /dev/null
|
||||||
|
soft_start > /dev/null
|
||||||
|
#tail -f /dev/null
|
||||||
|
${init_path}/bt log
|
41
arm64/init_mysql.sh
Normal file
41
arm64/init_mysql.sh
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
Root_Path=`cat /var/bt_setupPath.conf`
|
||||||
|
Setup_Path=$Root_Path/server/mysql
|
||||||
|
Data_Path=$Root_Path/server/data
|
||||||
|
|
||||||
|
Mysql_Initialize(){
|
||||||
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
check_z=$(ls "${Data_Path}")
|
||||||
|
if [[ ! -z "${check_z}" ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ${Data_Path}
|
||||||
|
chown -R mysql:mysql ${Data_Path}
|
||||||
|
chgrp -R mysql ${Setup_Path}/.
|
||||||
|
|
||||||
|
${Setup_Path}/bin/mysqld --initialize-insecure --basedir=${Setup_Path} --datadir=${Data_Path} --user=mysql
|
||||||
|
|
||||||
|
cat > /etc/ld.so.conf.d/mysql.conf<<EOF
|
||||||
|
${Setup_Path}/lib
|
||||||
|
EOF
|
||||||
|
ldconfig
|
||||||
|
ln -sf ${Setup_Path}/lib/mysql /usr/lib/mysql
|
||||||
|
ln -sf ${Setup_Path}/include/mysql /usr/include/mysql
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
|
||||||
|
mysqlpwd=`cat /dev/urandom | head -n 16 | md5sum | head -c 16`
|
||||||
|
${Setup_Path}/bin/mysqladmin -u root password "${mysqlpwd}"
|
||||||
|
|
||||||
|
cd "${Setup_Path}"
|
||||||
|
rm -f src.tar.gz
|
||||||
|
rm -rf src
|
||||||
|
/etc/init.d/mysqld start
|
||||||
|
rm -rf /init_mysql.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
Mysql_Initialize
|
2
bt.sh
2
bt.sh
@ -38,7 +38,7 @@ soft_start(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
init_mysql(){
|
init_mysql(){
|
||||||
if [ "${O_pl}" != "docker_btlamp_d12" ] && [ "${O_pl}" != "docker_btlnmp_d12" ];then
|
if [ "${O_pl}" != "docker_btlamp_nas" ] && [ "${O_pl}" != "docker_btlnmp_nas" ];then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [ -d "${Data_Path}" ]; then
|
if [ -d "${Data_Path}" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user