修复虎牙验证运行时依赖
Docker 镜像补充 nodejs,支持 pyexecjs 执行虎牙滑块验证,并增加镜像源失败回退。
This commit is contained in:
+12
-8
@@ -10,23 +10,27 @@ RUN npm run build
|
||||
# ===== 阶段2: Python 运行时 =====
|
||||
FROM python:3.12-slim AS runtime
|
||||
|
||||
# 使用腾讯云镜像源加速(国内服务器)
|
||||
RUN sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list.d/debian.sources
|
||||
|
||||
# 安装 OpenCV 系统依赖
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
# 优先使用腾讯云镜像源加速;不可用时自动回退官方源。
|
||||
RUN cp /etc/apt/sources.list.d/debian.sources /tmp/debian.sources && \
|
||||
sed -i 's/deb.debian.org/mirrors.tencentyun.com/g' /etc/apt/sources.list.d/debian.sources && \
|
||||
(apt-get update -o APT::Update::Error-Mode=any || \
|
||||
(cp /tmp/debian.sources /etc/apt/sources.list.d/debian.sources && \
|
||||
apt-get update -o APT::Update::Error-Mode=any)) && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 安装 uv(通过 pip + 国内镜像,避免依赖 ghcr.io 国内网络问题)
|
||||
RUN pip install -i https://mirrors.tencentyun.com/pypi/simple uv
|
||||
# 安装 uv:优先腾讯云 PyPI,失败时回退默认 PyPI。
|
||||
RUN pip install -i https://mirrors.tencentyun.com/pypi/simple uv || pip install uv
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 先复制依赖文件,利用 Docker 缓存层
|
||||
COPY pyproject.toml uv.lock* README.md alembic.ini ./
|
||||
RUN uv venv /app/.venv && UV_INDEX_URL=https://mirrors.tencentyun.com/pypi/simple uv pip install -e .
|
||||
RUN uv venv /app/.venv && \
|
||||
(UV_INDEX_URL=https://mirrors.tencentyun.com/pypi/simple uv pip install -e . || uv pip install -e .)
|
||||
|
||||
# 复制项目代码
|
||||
COPY core/ ./core/
|
||||
|
||||
Reference in New Issue
Block a user