mirror of
				https://github.com/suyiiyii/nonebot-bison.git
				synced 2025-11-04 13:34:52 +08:00 
			
		
		
		
	🚀 在现有 Dockerfile 的基础上,修改无浏览器镜像
This commit is contained in:
		
							parent
							
								
									8c6e77dd94
								
							
						
					
					
						commit
						8550ff975a
					
				@ -105,9 +105,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
 | 
				
			|||||||
    PYTHONUNBUFFERED=1 \
 | 
					    PYTHONUNBUFFERED=1 \
 | 
				
			||||||
    UV_LINK_MODE=copy \
 | 
					    UV_LINK_MODE=copy \
 | 
				
			||||||
    TZ=Asia/Shanghai \
 | 
					    TZ=Asia/Shanghai \
 | 
				
			||||||
    SHELL="/bin/bash" \
 | 
					    SHELL="/bin/bash"
 | 
				
			||||||
    PNPM_HOME="/pnpm" \
 | 
					 | 
				
			||||||
    PATH="/pnpm:${PATH}"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN echo "📦 Installing system dependencies..." && \
 | 
					RUN echo "📦 Installing system dependencies..." && \
 | 
				
			||||||
    apt-get update && \
 | 
					    apt-get update && \
 | 
				
			||||||
 | 
				
			|||||||
@ -98,66 +98,14 @@ FROM python:3.12-slim AS production
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ENV UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
 | 
					
 | 
				
			||||||
ENV DEBIAN_FRONTEND=noninteractive \
 | 
					ENV DEBIAN_FRONTEND=noninteractive \
 | 
				
			||||||
    UV_COMPILE_BYTECODE=1 \
 | 
					    UV_COMPILE_BYTECODE=1 \
 | 
				
			||||||
    UV_SYSTEM_PYTHON=true \
 | 
					    UV_SYSTEM_PYTHON=true \
 | 
				
			||||||
    PYTHONUNBUFFERED=1 \
 | 
					    PYTHONUNBUFFERED=1 \
 | 
				
			||||||
    UV_LINK_MODE=copy \
 | 
					    UV_LINK_MODE=copy \
 | 
				
			||||||
    TZ=Asia/Shanghai \
 | 
					    TZ=Asia/Shanghai \
 | 
				
			||||||
    SHELL="/bin/bash" \
 | 
					    SHELL="/bin/bash"
 | 
				
			||||||
    PNPM_HOME="/pnpm" \
 | 
					 | 
				
			||||||
    PATH="/pnpm:${PATH}"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN echo "📦 Installing system dependencies..." && \
 | 
					 | 
				
			||||||
    apt-get update && \
 | 
					 | 
				
			||||||
    apt-get install -y --no-install-recommends \
 | 
					 | 
				
			||||||
        curl \
 | 
					 | 
				
			||||||
        xvfb \
 | 
					 | 
				
			||||||
        fonts-noto-color-emoji \
 | 
					 | 
				
			||||||
        fonts-unifont \
 | 
					 | 
				
			||||||
        libfontconfig1 \
 | 
					 | 
				
			||||||
        libfreetype6 \
 | 
					 | 
				
			||||||
        xfonts-scalable \
 | 
					 | 
				
			||||||
        fonts-liberation \
 | 
					 | 
				
			||||||
        fonts-ipafont-gothic \
 | 
					 | 
				
			||||||
        fonts-wqy-zenhei \
 | 
					 | 
				
			||||||
        fonts-tlwg-loma-otf \
 | 
					 | 
				
			||||||
        at-spi2-common \
 | 
					 | 
				
			||||||
        fonts-freefont-ttf \
 | 
					 | 
				
			||||||
        libasound2 \
 | 
					 | 
				
			||||||
        libasound2-data \
 | 
					 | 
				
			||||||
        libatk-bridge2.0-0 \
 | 
					 | 
				
			||||||
        libatk1.0-0 \
 | 
					 | 
				
			||||||
        libatspi2.0-0 \
 | 
					 | 
				
			||||||
        libavahi-client3 \
 | 
					 | 
				
			||||||
        libavahi-common-data \
 | 
					 | 
				
			||||||
        libavahi-common3 \
 | 
					 | 
				
			||||||
        libcairo2 \
 | 
					 | 
				
			||||||
        libcups2 \
 | 
					 | 
				
			||||||
        libdatrie1 \
 | 
					 | 
				
			||||||
        libdbus-1-3 \
 | 
					 | 
				
			||||||
        libfribidi0 \
 | 
					 | 
				
			||||||
        libgbm1 \
 | 
					 | 
				
			||||||
        libglib2.0-0 \
 | 
					 | 
				
			||||||
        libgraphite2-3 \
 | 
					 | 
				
			||||||
        libharfbuzz0b \
 | 
					 | 
				
			||||||
        libnspr4 \
 | 
					 | 
				
			||||||
        libnss3 \
 | 
					 | 
				
			||||||
        libpango-1.0-0 \
 | 
					 | 
				
			||||||
        libthai-data \
 | 
					 | 
				
			||||||
        libthai0 \
 | 
					 | 
				
			||||||
        libwayland-server0 \
 | 
					 | 
				
			||||||
        libxcb-render0 \
 | 
					 | 
				
			||||||
        libxcomposite1 \
 | 
					 | 
				
			||||||
        libxdamage1 \
 | 
					 | 
				
			||||||
        libxi6 \
 | 
					 | 
				
			||||||
        libxkbcommon0 && \
 | 
					 | 
				
			||||||
    fc-cache -fv && \
 | 
					 | 
				
			||||||
    apt-get clean && \
 | 
					 | 
				
			||||||
    rm -rf /var/lib/apt/lists/* && \
 | 
					 | 
				
			||||||
    echo "✅ System dependencies installed successfully"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 | 
					COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
 | 
				
			||||||
RUN echo "🔔 Verifying uv installation..." && \
 | 
					RUN echo "🔔 Verifying uv installation..." && \
 | 
				
			||||||
@ -168,6 +116,7 @@ RUN echo "🔔 Verifying uv installation..." && \
 | 
				
			|||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY ./pyproject.toml ./uv.lock ./
 | 
					COPY ./pyproject.toml ./uv.lock ./
 | 
				
			||||||
 | 
					COPY ./docker.env.prod ./.env
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN --mount=type=cache,target=/root/.cache/ \
 | 
					RUN --mount=type=cache,target=/root/.cache/ \
 | 
				
			||||||
    --mount=type=cache,target=/root/.uv \
 | 
					    --mount=type=cache,target=/root/.uv \
 | 
				
			||||||
@ -181,10 +130,12 @@ RUN --mount=type=cache,target=/root/.cache/ \
 | 
				
			|||||||
COPY --from=metadata-stage /tmp/VERSION /app/VERSION
 | 
					COPY --from=metadata-stage /tmp/VERSION /app/VERSION
 | 
				
			||||||
COPY nonebot_bison/ /app/nonebot_bison/
 | 
					COPY nonebot_bison/ /app/nonebot_bison/
 | 
				
			||||||
COPY --from=frontend-stage /tmp/nonebot_bison/admin_page/dist ./nonebot_bison/admin_page/dist
 | 
					COPY --from=frontend-stage /tmp/nonebot_bison/admin_page/dist ./nonebot_bison/admin_page/dist
 | 
				
			||||||
COPY --from=playwright-stage /root/.cache/ms-playwright /root/.cache/ms-playwright
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXPOSE 8080
 | 
					EXPOSE 8080
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENV BISON_SKIP_BROWSER_CHECK=True \
 | 
				
			||||||
 | 
					    BISON_USE_BROWSER=False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN echo '#!/bin/bash' > /app/start.sh && \
 | 
					RUN echo '#!/bin/bash' > /app/start.sh && \
 | 
				
			||||||
    echo 'echo "📌 Current bison Version: $(cat /app/VERSION)"' >> /app/start.sh && \
 | 
					    echo 'echo "📌 Current bison Version: $(cat /app/VERSION)"' >> /app/start.sh && \
 | 
				
			||||||
    echo 'echo "🚀 Starting service..."' >> /app/start.sh && \
 | 
					    echo 'echo "🚀 Starting service..."' >> /app/start.sh && \
 | 
				
			||||||
@ -9,14 +9,16 @@ from nonebot import logger, require
 | 
				
			|||||||
from playwright.async_api import Cookie
 | 
					from playwright.async_api import Cookie
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from nonebot_bison.config.db_model import Cookie as CookieModel
 | 
					from nonebot_bison.config.db_model import Cookie as CookieModel
 | 
				
			||||||
 | 
					from nonebot_bison.plugin_config import plugin_config
 | 
				
			||||||
from nonebot_bison.utils import Site, http_client
 | 
					from nonebot_bison.utils import Site, http_client
 | 
				
			||||||
from nonebot_bison.utils.site import CookieClientManager
 | 
					from nonebot_bison.utils.site import CookieClientManager
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if TYPE_CHECKING:
 | 
					if TYPE_CHECKING:
 | 
				
			||||||
    from .platforms import Bilibili
 | 
					    from .platforms import Bilibili
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require("nonebot_plugin_htmlrender")
 | 
					if plugin_config.bison_use_browser:
 | 
				
			||||||
from nonebot_plugin_htmlrender import get_browser
 | 
					    require("nonebot_plugin_htmlrender")
 | 
				
			||||||
 | 
					    from nonebot_plugin_htmlrender import get_browser
 | 
				
			||||||
 | 
					
 | 
				
			||||||
B = TypeVar("B", bound="Bilibili")
 | 
					B = TypeVar("B", bound="Bilibili")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user