222222 / Dockerfile
Yvan-W's picture
Update Dockerfile
2ad4b68 verified
FROM node:22
# 更改dns
# RUN chmod 777 /etc/resolv.conf && echo 'nameserver 8.8.8.8' > /etc/resolv.conf
# 设置运行目录
WORKDIR /RUN
# 复制必要文件
COPY . /RUN
# 安装必要依赖&软件
RUN rm -rf /etc/apt/sources.list.d/debian.sources && mv debian.sources /etc/apt/sources.list.d/ && \
apt update -y && \
apt install redis-server ffmpeg atomicparsley chromium inetutils-ping wget unzip cron fonts-noto-cjk ttf-wqy-zenhei fontconfig aria2 -y && \
mkdir -p /home/node/.local/bin/ && \
curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /home/node/.local/bin/yt-dlp && \
chmod a+rx /home/node/.local/bin/yt-dlp && \
sed -i '$a\export PATH="/home/node:$PATH"' ~/.bashrc && \
fc-cache -f -v && \
curl -sSL https://docs.iyear.me/tdl/install.sh | bash && \
npm install pnpm -g && \
npm install freyr -g
# 设置运行目录
WORKDIR /RUN
# 复制必要文件
COPY . /RUN
# 设置环境变量
ENV PATH="/home/node/.local/bin:$PATH"
# 安装TRSS-Yunzai本体
RUN git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai.git ./Elysia_TRSS
RUN cd Elysia_TRSS && \
# 安装插件(可自行添加或删除,相关依赖自行在 安装依赖 部分添加 安装Yenai-plugin请不要pnpm i -p)
# Genshin
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-genshin.git ./plugins/genshin/ && \
# miao-plugin
git clone --depth=1 https://github.com/yoimiya-kokomi/miao-plugin.git ./plugins/miao-plugin/ && \
# R插件
git clone --depth=1 https://github.com/zhiyu1998/rconsole-plugin.git ./plugins/rconsole-plugin/ && \
# 锅巴插件
git clone --depth=1 https://github.com/guoba-yunzai/guoba-plugin.git ./plugins/Guoba-Plugin/ && \
# 椰奶
git clone -b master --depth=1 https://github.com/Yvan-W/yenai-plugin.git ./plugins/yenai-plugin && \
# TRSS-Plugin
git clone --depth 1 https://github.com/TimeRainStarSky/TRSS-Plugin.git ./plugins/TRSS-Plugin && \
# ws-plugin
git clone --depth=1 https://github.com/XasYer/ws-plugin.git ./plugins/ws-plugin/ && \
pnpm install --filter=ws-plugin && \
# auto-plugin
git clone --depth=1 https://github.com/Nwflower/auto-plugin.git ./plugins/auto-plugin/ && \
# 土块
git clone --depth=1 https://github.com/SmallK111407/earth-k-plugin.git ./plugins/earth-k-plugin/ && \
# FanSky_Qs
git clone --depth=1 https://github.com/AFanSKyQs/FanSky_Qs.git ./plugins/FanSky_Qs/ && \
cd plugins/FanSky_Qs && \
pnpm install && \
cd ../../ && \
# flower-plugin
git clone --depth=1 https://github.com/Nwflower/flower-plugin.git ./plugins/flower-plugin/ && \
# hanhan-plugin
git clone --depth=1 https://github.com/hanhan258/hanhan-plugin.git ./plugins/hanhan-plugin && \
cd ./plugins/hanhan-plugin && \
pnpm i && \
cd ../../ && \
# hl-ly-plugin
git clone --depth 1 https://gitee.com/fox-glaze/hl-ly-plugin ./plugins/hl-ly-plugin && \
# liangshi-calc
git clone --depth=1 https://github.com/liangshi233/liangshi-calc.git ./plugins/liangshi-calc/ && \
# xianxin-plugin
git clone https://github.com/xianxincoder/xianxin-plugin.git ./plugins/xianxin-plugin/ && \
# ql-plugin
git clone --depth 1 https://github.com/xwy231321/ql-plugin.git ./plugins/ql-plugin/ && \
# StarRail-plugin
git clone --depth=1 https://github.com/TsukinaKasumi/StarRail-plugin.git ./plugins/StarRail-plugin && \
# waves-plugin
git clone https://github.com/erzaozi/waves-plugin.git ./plugins/waves-plugin && \
# xiaoyao-cvs-plugin
git clone https://github.com/Ctrlcvs/xiaoyao-cvs-plugin.git ./plugins/xiaoyao-cvs-plugin/ && \
# ZZZ-Plugin
git clone --depth=1 https://github.com/ZZZure/ZZZ-Plugin.git ./plugins/ZZZ-Plugin && \
# 安装适配器
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-Lagrange-Plugin.git ./plugins/Lagrange-Plugin && \
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-Telegram-Plugin.git ./plugins/Telegram-Plugin && \
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-Discord-Plugin.git ./plugins/Discord-Plugin && \
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-WeChat-Plugin.git ./plugins/WeChat-Plugin && \
git clone --depth 1 https://gitee.com/xiaoye12123/Yunzai-QQBot-Plugin.git ./plugins/QQBot-Plugin && \
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-ICQQ-Plugin.git ./plugins/ICQQ-Plugin && \
git clone --depth 1 https://github.com/TimeRainStarSky/Yunzai-KOOK-Plugin.git ./plugins/KOOK-Plugin
# 提前准备账号配置文件(避免重启后再次登录) 涉及Secrets 不懂的请直接注释
RUN --mount=type=secret,id=Login_Information,mode=0444,required=true \
wget $(cat /run/secrets/Login_Information) && unzip -d Elysia_TRSS/config/Login_information.zip
# GITHUB_TOKEN
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
rm -rf ./Elysia_TRSS/plugins/ICQQ-Plugin/.npmrc && \
rm -rf ./Elysia_TRSS/.npmrc && \
wget -P ./Elysia_TRSS $(cat /run/secrets/GITHUB_TOKEN) && wget -P ./Elysia_TRSS/plugins/ICQQ-Plugin $(cat /run/secrets/GITHUB_TOKEN)
# ICQQ
RUN cd ./Elysia_TRSS/plugins/ICQQ-Plugin && \
pnpm add icqq@npm:@icqqjs/icqq
# ICQQ的登录Token
# RUN --mount=type=secret,id=ICQQTK,mode=0444,required=true \
# wget $(cat /run/secrets/ICQQTK) && unzip icqq.zip -d icqq && mkdir -p Elysia_TRSS/data && mv icqq Elysia_TRSS/data/
# 设置配置文件
RUN cd Elysia_TRSS && \
# TG适配器测试
# sed -i '20a\ "grammy": "^1.28.0",' package.json && \
# 锅巴相关
sed -i '15c\ host: yvan-w-fklwjkbdi.hf.space' ./plugins/Guoba-Plugin/defSet/application.yaml && \
sed -i '21c\ splicePort: false' ./plugins/Guoba-Plugin/defSet/application.yaml && \
# 修改土块防止与R冲突
sed -i "19c\ reg: '土块https://www.bilibili.com(.*)|土块https://b23.tv(.*)'," plugins/earth-k-plugin/apps/bilibilitv.js
# 配置文件
RUN git clone --depth 1 https://github.com/Smurf-Yvan/TRSS-Config.git && \
cp -r TRSS-Config/config ./Elysia_TRSS/config/ && \
cp -r TRSS-Config/plugins ./Elysia_TRSS && \
mv TRSS-Config/BBDown ./ && \
# 帮助文件配置
cp -r TRSS-Config/miao-plugin ./Elysia_TRSS/plugins/
# ICQQ锅巴支持
# mv guoba.support.js /RUN/Elysia_TRSS/plugins/ICQQ-Plugin/
# 涉及密钥(fork请注释)
# 下载R插件配置文件
RUN --mount=type=secret,id=RCONFIG,mode=0444,required=true \
wget $(cat /run/secrets/RCONFIG) -O ./Elysia_TRSS/plugins/rconsole-plugin/config/tools.yaml
# 安装依赖
RUN cd Elysia_TRSS && \
# 整体
pnpm i && \
# R插件
pnpm i -P --prefix ./plugins/rconsole-plugin/ && \
# 锅巴
pnpm install --filter=guoba-plugin
# 涉及密钥(fork请注释)
# 下载R插件TG&BILIBILI_TOKEN
RUN --mount=type=secret,id=RTG_BBDOWN,mode=0444,required=true \
wget $(cat /run/secrets/RTG_BBDOWN) && unzip rconsole_plugin.zip && \
mv BBDown BBDown.data -t /usr/local/bin/ && \
mv .tdl /home/node/ && \
cd /usr/local/bin && chmod 777 BBDown BBDown.data
# 椰奶搜图IPA
RUN --mount=type=secret,id=PICAPI,mode=0444,required=true \
wget $(cat /run/secrets/PICAPI) -O ./Elysia_TRSS/plugins/yenai-plugin/config/default_config/picSearch.yaml
# 同步data文件
RUN 1122332 sync Onedrive:/OtherFiles/HuggingFace_Secret/data /RUN/Elysia_TRSS/data && \
mkdir -p /home/node/.config/rclone/ && \
mv /root/.config/rclone/rclone.conf /home/node/.config/rclone/
# 设置222同步
RUN service cron start && \
crontab cron-file
# 设置配置文件权限
RUN chmod 777 -R ./*
RUN chmod 777 -R /home/node
# 运行应用
CMD cd Elysia_TRSS && bash -c 'while true; do node_modules/.bin/pm2 kill; node app; done'