Merge branch 'master' of github.com:yoimiya-kokomi/Miao-Yunzai
This commit is contained in:
commit
076e7de60f
|
@ -2,7 +2,14 @@ version: "3"
|
||||||
services:
|
services:
|
||||||
miao-yunzai:
|
miao-yunzai:
|
||||||
container_name: miao-yunzai
|
container_name: miao-yunzai
|
||||||
build: ./docker # 使用 Dockerfile 本地构建
|
build: # 使用 Dockerfile 本地构建
|
||||||
|
context: ./docker
|
||||||
|
args:
|
||||||
|
BUNDLE_FFMPEG: false # 是否在构建时打包 ffmpeg
|
||||||
|
BUNDLE_POETRY: false # 是否在构建时打包 poetry
|
||||||
|
USE_APT_MIRROR: true # 是否在构建时使用 apt 镜像
|
||||||
|
USE_NPM_MIRROR: true # 是否在构建时使用 npm 镜像
|
||||||
|
USE_PYPI_MIRROR: true # 是否在构建时使用 pypi 镜像
|
||||||
restart: always
|
restart: always
|
||||||
# ports:
|
# ports:
|
||||||
# - "50831:50831" # 映射锅巴插件端口,格式"主机端口:容器内部端口"
|
# - "50831:50831" # 映射锅巴插件端口,格式"主机端口:容器内部端口"
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
FROM debian:stable AS resource
|
FROM busybox:latest AS resource
|
||||||
|
|
||||||
RUN sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" /etc/apt/sources.list \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get upgrade -y \
|
|
||||||
&& apt-get install -y wget xz-utils dos2unix \
|
|
||||||
&& wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz \
|
|
||||||
&& mkdir -p /res/ffmpeg \
|
|
||||||
&& tar -xvf ./ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz -C /res/ffmpeg --strip-components 1
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /res/entrypoint.sh
|
COPY docker-entrypoint.sh /res/entrypoint.sh
|
||||||
|
|
||||||
|
@ -16,35 +8,65 @@ RUN dos2unix /res/entrypoint.sh \
|
||||||
|
|
||||||
FROM node:lts-slim AS runtime
|
FROM node:lts-slim AS runtime
|
||||||
|
|
||||||
COPY --from=resource /res/ffmpeg/ffmpeg /usr/bin/ffmpeg
|
ARG BUNDLE_FFMPEG true
|
||||||
|
ARG BUNDLE_POETRY true
|
||||||
|
ARG USE_APT_MIRROR true
|
||||||
|
ARG USE_NPM_MIRROR true
|
||||||
|
ARG USE_PYPI_MIRROR true
|
||||||
|
ARG REPO_URL https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git
|
||||||
|
ARG REPO_BRANCH master
|
||||||
|
|
||||||
COPY --from=resource /res/ffmpeg/ffprobe /usr/bin/ffprobe
|
RUN export BUNDLE_FFMPEG=${BUNDLE_FFMPEG:-true} \
|
||||||
|
&& export BUNDLE_POETRY=${BUNDLE_POETRY:-true} \
|
||||||
RUN sed -i "s/deb.debian.org/mirrors.ustc.edu.cn/g" /etc/apt/sources.list \
|
&& export USE_APT_MIRROR=${USE_APT_MIRROR:-true} \
|
||||||
|
&& export USE_NPM_MIRROR=${USE_NPM_MIRROR:-true} \
|
||||||
|
&& export USE_PYPI_MIRROR=${USE_PYPI_MIRROR:-true} \
|
||||||
|
\
|
||||||
|
&& ((test "$USE_APT_MIRROR"x = "true"x \
|
||||||
|
&& sed -i "s/deb.debian.org/mirrors.bit.edu.cn/g" /etc/apt/sources.list) || true) \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get upgrade -y \
|
&& apt-get upgrade -y \
|
||||||
&& apt-get install -y curl wget gnupg git python3-pip python3-venv fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \
|
&& apt-get install -y wget xz-utils dos2unix \
|
||||||
|
&& ((test "$BUNDLE_FFMPEG"x = "true"x \
|
||||||
|
&& wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz \
|
||||||
|
&& mkdir -p /res/ffmpeg \
|
||||||
|
&& tar -xvf ./ffmpeg-git-$(dpkg --print-architecture)-static.tar.xz -C /res/ffmpeg --strip-components 1 \
|
||||||
|
&& cp /res/ffmpeg/ffmpeg /usr/bin/ffmpeg \
|
||||||
|
&& cp /res/ffmpeg/ffprobe /usr/bin/ffprobe) || true) \
|
||||||
|
\
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get upgrade -y \
|
||||||
|
&& apt-get install -y curl wget gnupg git fonts-wqy-microhei xfonts-utils chromium fontconfig libxss1 libgl1 \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& apt-get clean
|
&& apt-get clean \
|
||||||
|
\
|
||||||
RUN fc-cache -f -v
|
&& fc-cache -f -v \
|
||||||
|
\
|
||||||
RUN git config --global --add safe.directory '*' \
|
&& git config --global --add safe.directory '*' \
|
||||||
&& git config --global pull.rebase false \
|
&& git config --global pull.rebase false \
|
||||||
&& git config --global user.email "Yunzai@yunzai.bot" \
|
&& git config --global user.email "Yunzai@yunzai.bot" \
|
||||||
&& git config --global user.name "Yunzai"
|
&& git config --global user.name "Yunzai" \
|
||||||
|
\
|
||||||
RUN npm install pnpm -g
|
&& _NPM_MIRROR_FLAG="" \
|
||||||
|
&& if [ "$USE_NPM_MIRROR"x = "true"x ]; then _NPM_MIRROR_FLAG="--registry=https://registry.npmmirror.com"; fi \
|
||||||
RUN ln -s /usr/bin/python3 /usr/bin/python \
|
&& npm install pnpm -g $_NPM_MIRROR_FLAG \
|
||||||
|
\
|
||||||
|
&& ((test "$BUNDLE_POETRY"x = "true"x \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y python3-pip python3-venv \
|
||||||
|
&& apt-get autoremove \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& ln -s /usr/bin/python3 /usr/bin/python \
|
||||||
&& POETRY_HOME=$HOME/venv-poetry \
|
&& POETRY_HOME=$HOME/venv-poetry \
|
||||||
&& python -m venv $POETRY_HOME \
|
&& python -m venv $POETRY_HOME \
|
||||||
&& $POETRY_HOME/bin/pip install --upgrade pip setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
&& _PYPI_MIRROR_FLAG="" \
|
||||||
&& $POETRY_HOME/bin/pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
&& if [ "$USE_PYPI_MIRROR"x = "true"x ]; then _PYPI_MIRROR_FLAG="-i https://pypi.tuna.tsinghua.edu.cn/simple"; fi \
|
||||||
|
&& $POETRY_HOME/bin/pip install --upgrade pip setuptools $_PYPI_MIRROR_FLAG \
|
||||||
|
&& $POETRY_HOME/bin/pip install poetry $_PYPI_MIRROR_FLAG \
|
||||||
&& ln -s $POETRY_HOME/bin/poetry /usr/bin \
|
&& ln -s $POETRY_HOME/bin/poetry /usr/bin \
|
||||||
&& poetry config virtualenvs.in-project true
|
&& poetry config virtualenvs.in-project true) || true) \
|
||||||
|
\
|
||||||
RUN rm -rf /var/cache/* \
|
&& rm -rf /var/cache/* \
|
||||||
&& rm -rf /tmp/*
|
&& rm -rf /tmp/*
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,10 +75,17 @@ FROM runtime AS prod
|
||||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
|
||||||
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
|
||||||
|
|
||||||
RUN git clone --depth=1 --branch master https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git /app/Miao-Yunzai\
|
RUN REPO_URL=${REPO_URL:-"https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git"} \
|
||||||
|
&& REPO_BRANCH=${REPO_BRANCH:-master} \
|
||||||
|
&& USE_NPM_MIRROR=${USE_NPM_MIRROR:-true} \
|
||||||
|
\
|
||||||
|
&& _NPM_MIRROR_FLAG="" \
|
||||||
|
&& if [ "$USE_NPM_MIRROR"x = "true"x ]; then _NPM_MIRROR_FLAG="--registry=https://registry.npmmirror.com"; fi \
|
||||||
|
&& git clone --depth=1 --branch $REPO_BRANCH $REPO_URL /app/Miao-Yunzai \
|
||||||
&& cd /app/Miao-Yunzai \
|
&& cd /app/Miao-Yunzai \
|
||||||
&& sed -i 's/127.0.0.1/redis/g' ./config/default_config/redis.yaml \
|
&& sed -i 's/127.0.0.1/redis/g' ./config/default_config/redis.yaml \
|
||||||
&& pnpm install -P
|
&& pnpm install -P $_NPM_MIRROR_FLAG \
|
||||||
|
&& git remote set-url origin https://gitee.com/yoimiya-kokomi/Miao-Yunzai.git
|
||||||
|
|
||||||
COPY --from=resource /res/entrypoint.sh /app/Miao-Yunzai/entrypoint.sh
|
COPY --from=resource /res/entrypoint.sh /app/Miao-Yunzai/entrypoint.sh
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,7 @@ class Puppeteer {
|
||||||
'--disable-gpu',
|
'--disable-gpu',
|
||||||
'--disable-setuid-sandbox',
|
'--disable-setuid-sandbox',
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
'--no-zygote',
|
'--no-zygote'
|
||||||
'--single-process'
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
"node-schedule": "^2.1.1",
|
"node-schedule": "^2.1.1",
|
||||||
"node-xlsx": "^0.21.0",
|
"node-xlsx": "^0.21.0",
|
||||||
"oicq": "^2.3.1",
|
"oicq": "^2.3.1",
|
||||||
"pm2": "^5.2.2",
|
"pm2": "^5.3.0",
|
||||||
"puppeteer": "^19.7.4",
|
"puppeteer": "^19.8.0",
|
||||||
"redis": "^4.6.5",
|
"redis": "^4.6.5",
|
||||||
"sequelize": "^6.29.3",
|
"sequelize": "^6.29.3",
|
||||||
"sqlite3": "^5.1.4",
|
"sqlite3": "^5.1.6",
|
||||||
"yaml": "^2.2.1"
|
"yaml": "^2.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -395,6 +395,12 @@ export default class MysNews extends base {
|
||||||
let sended = await redis.get(`${this.key}${groupId}:${postId}`)
|
let sended = await redis.get(`${this.key}${groupId}:${postId}`)
|
||||||
if (sended) return
|
if (sended) return
|
||||||
|
|
||||||
|
// 判断是否存在群关系
|
||||||
|
if (!Bot.gl.get(Number(groupId))) {
|
||||||
|
logger.error(`[米游社${typeName}推送] 群${groupId}未关联`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!this[postId]) {
|
if (!this[postId]) {
|
||||||
const param = await this.newsDetail(postId)
|
const param = await this.newsDetail(postId)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue