mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[update] DockerFile
This commit is contained in:
parent
1f5a2aa94c
commit
d7e086cb42
2
.github/workflows/build_image_bhp.yml
vendored
2
.github/workflows/build_image_bhp.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
publish: true
|
||||
imageName: lkeme/bilihelper-personal
|
||||
dockerFile: docker/Dockerfile
|
||||
platform: linux/amd64,linux/arm64,linux/arm/v7
|
||||
platform: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v8
|
||||
tag: latest
|
||||
dockerUser: ${{ secrets.DOCKER_USERNAME }}
|
||||
dockerPassword: ${{ secrets.DOCKER_PASSWORD }}
|
||||
8
DOC.md
8
DOC.md
@ -171,6 +171,14 @@ $ docker run -itd --rm -e USER_NAME=你的B站登录账号 -e USER_PASSWORD=你
|
||||
$ docker run -itd --rm -v /path/to/your/confFileName.ini:/app/conf/user.ini lkeme/bilihelper-personal
|
||||
```
|
||||
|
||||
- 使用github镜像加速
|
||||
|
||||
```bash
|
||||
$ -e MIRRORS=0 # 使用 github.com
|
||||
$ -e MIRRORS=1 # 使用 ghproxy.com
|
||||
$ -e MIRRORS=2 # 使用 github.com.cnpmjs.org
|
||||
```
|
||||
|
||||
- 相关参数
|
||||
|
||||
```ps
|
||||
|
||||
@ -67,9 +67,10 @@ enable = true
|
||||
[live_capsule]
|
||||
enable = true
|
||||
|
||||
; 点亮灰色勋章
|
||||
; 点亮灰色勋章|100亲密度|每日或者只点亮灰色
|
||||
[polish_the_medal]
|
||||
enable = true
|
||||
everyday = false
|
||||
|
||||
; 主站九宫格抽奖活动助手
|
||||
[main_activity]
|
||||
|
||||
@ -6,7 +6,7 @@ LABEL AUTHOR = "Lkeme <Useri@live.cn>"
|
||||
ENV USER_NAME='' \
|
||||
USER_PASSWORD='' \
|
||||
REPO_URL='https://github.com/' \
|
||||
# CN=false \
|
||||
MIRRORS="0" \
|
||||
CONIFG_PATH='/app/conf/user.ini' \
|
||||
Green="\\033[32m" \
|
||||
Red="\\033[31m" \
|
||||
@ -22,7 +22,8 @@ ENV USER_NAME='' \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
|
||||
RUN docker-php-ext-install sockets
|
||||
|
||||
#RUN if [ "${CN}" = true ]; then export REPO_URL="https://github.com.cnpmjs.org"; fi
|
||||
@ -33,15 +34,12 @@ RUN docker-php-ext-install sockets
|
||||
|
||||
RUN apk add --no-cache git && \
|
||||
git clone ${REPO_URL}/lkeme/BiliHelper-personal.git --depth=1 /app && \
|
||||
cp -f /app/docker/entrypoint.sh /usr/local/bin/entrypoint.sh && \
|
||||
chmod 777 /usr/local/bin/entrypoint.sh && \
|
||||
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" && \
|
||||
php composer-setup.php && \
|
||||
php composer.phar install && \
|
||||
rm -r /var/cache/apk && \
|
||||
rm -r /usr/share/man
|
||||
|
||||
ENTRYPOINT echo -e "\n ======== \n ${Info} ${GreenBG} 正使用 git pull 同步项目 ${Font} \n ======== \n" && \
|
||||
git pull && \
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 安装/更新 项目运行依赖 ${Font} \n ======== \n" && \
|
||||
php composer.phar install && \
|
||||
echo -e "\n \n \n \n" && \
|
||||
if [[ -f ${CONIFG_PATH} ]]; then echo -e "\n ======== \n ${GreenBG} 正在使用外部配置文件 ${Font} \n ======== \n" && php index.php ; else echo -e "${OK} ${GreenBG} 正在使用传入的环境变量进行用户配置。\n 如果需要配置更多选择项,请通过挂载配置文件来传入。具体参考项目中的README。\n https://github.com/lkeme/BiliHelper-personal.git ${Font} \n ======== \n " && cp /app/conf/user.ini.example /app/conf/user.ini && sed -i ''"$(cat /app/conf/user.ini -n | grep "username = \"\"" | awk '{print $1}')"'c '"$(echo "username = \"${USER_NAME}\"")"'' ${CONIFG_PATH} && sed -i ''"$(cat /app/conf/user.ini -n | grep "password = \"\"" | awk '{print $1}')"'c '"$(echo "password = \"${USER_PASSWORD}\"")"'' ${CONIFG_PATH} && php index.php; fi
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
43
docker/entrypoint.sh
Normal file
43
docker/entrypoint.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# 源切换
|
||||
case ${MIRRORS} in
|
||||
"0")
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-github.com ${Font} \n ======== \n"
|
||||
git remote set-url origin https://github.com/lkeme/BiliHelper-personal.git
|
||||
;;
|
||||
"1")
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-ghproxy.com ${Font} \n ======== \n"
|
||||
git remote set-url origin https://ghproxy.com/https://github.com/lkeme/BiliHelper-personal.git
|
||||
;;
|
||||
"2")
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-github.com.cnpmjs.org ${Font} \n ======== \n"
|
||||
git remote set-url origin https://github.com.cnpmjs.org/lkeme/BiliHelper-personal.git
|
||||
;;
|
||||
*)
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 切换源-github.com ${Font} \n ======== \n"
|
||||
git remote set-url origin https://github.com/lkeme/BiliHelper-personal.git
|
||||
;;
|
||||
esac
|
||||
|
||||
# 拉取更新
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 正使用 git pull 同步项目 ${Font} \n ======== \n"
|
||||
git pull
|
||||
|
||||
# 安装依赖
|
||||
echo -e "\n ======== \n ${Info} ${GreenBG} 安装/更新 项目运行依赖 ${Font} \n ======== \n"
|
||||
php composer.phar install
|
||||
echo -e "\n \n \n \n"
|
||||
|
||||
# 判断类型
|
||||
if [[ -f ${CONIFG_PATH} ]]; then
|
||||
echo -e "\n ======== \n ${GreenBG} 正在使用外部配置文件 ${Font} \n ======== \n"
|
||||
else
|
||||
echo -e "${OK} ${GreenBG} 正在使用传入的环境变量进行用户配置。\n 如果需要配置更多选择项,请通过挂载配置文件来传入。具体参考项目中的README。\n https://github.com/lkeme/BiliHelper-personal.git ${Font} \n ======== \n "
|
||||
cp /app/conf/user.ini.example /app/conf/user.ini
|
||||
sed -i ''"$(cat /app/conf/user.ini -n | grep "username = \"\"" | awk '{print $1}')"'c '"$(echo "username = \"${USER_NAME}\"")"'' ${CONIFG_PATH}
|
||||
sed -i ''"$(cat /app/conf/user.ini -n | grep "password = \"\"" | awk '{print $1}')"'c '"$(echo "password = \"${USER_PASSWORD}\"")"'' ${CONIFG_PATH}
|
||||
fi
|
||||
|
||||
php index.php
|
||||
@ -29,12 +29,21 @@ class PolishTheMedal
|
||||
if (!getEnable('polish_the_medal')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取灰色勋章
|
||||
if (self::$metal_lock < time()) {
|
||||
// 如果勋章过多导致未处理完,就1小时一次,否则10小时一次。
|
||||
if (empty(self::$grey_fans_medals)) {
|
||||
self::fetchGreyMedalList();
|
||||
self::$metal_lock = time() + 10 * 60 * 60;
|
||||
// 处理每日
|
||||
if (getConf('everyday', 'polish_the_medal')) {
|
||||
// 如果是 直接定时到第二天7点
|
||||
self::fetchGreyMedalList(true);
|
||||
self::$metal_lock = time() + self::timing(7, 0, 0, true);
|
||||
} else {
|
||||
// 否则按正常逻辑
|
||||
self::fetchGreyMedalList();
|
||||
self::$metal_lock = time() + 10 * 60 * 60;
|
||||
}
|
||||
} else {
|
||||
self::$metal_lock = time() + 1 * 60 * 60;
|
||||
}
|
||||
@ -68,10 +77,12 @@ class PolishTheMedal
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @use 获取灰色勋章列表(过滤无勋章或已满)
|
||||
* @param bool $all
|
||||
*/
|
||||
private static function fetchGreyMedalList()
|
||||
private static function fetchGreyMedalList(bool $all = false)
|
||||
{
|
||||
$data = Live::fetchMedalList();
|
||||
foreach ($data as $vo) {
|
||||
@ -84,12 +95,20 @@ class PolishTheMedal
|
||||
'uid' => $vo['target_id'],
|
||||
'roomid' => $vo['roomid'],
|
||||
];
|
||||
// 灰色
|
||||
if ($vo['medal_color_start'] == 12632256 && $vo['medal_color_end'] == 12632256 && $vo['medal_color_border'] == 12632256) {
|
||||
// 如果是每天擦亮 ,就不过滤|否则过滤掉,只点亮灰色
|
||||
if ($all) {
|
||||
self::$grey_fans_medals[] = [
|
||||
'uid' => $vo['target_id'],
|
||||
'roomid' => $vo['roomid'],
|
||||
];
|
||||
} else {
|
||||
// 灰色
|
||||
if ($vo['medal_color_start'] == 12632256 && $vo['medal_color_end'] == 12632256 && $vo['medal_color_border'] == 12632256) {
|
||||
self::$grey_fans_medals[] = [
|
||||
'uid' => $vo['target_id'],
|
||||
'roomid' => $vo['roomid'],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
// 乱序
|
||||
|
||||
Loading…
Reference in New Issue
Block a user