FROM openclaw-sandbox:with-deps

USER root

# 安装系统依赖（weasyprint需要的字体和库）
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
    libpango-1.0-0 \
    libpangoft2-1.0-0 \
    libpangocairo-1.0-0 \
    libgdk-pixbuf2.0-0 \
    libffi-dev \
    shared-mime-info \
    fonts-wqy-microhei \
    fonts-wqy-zenhei \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# 复制所有本地whl文件
COPY wheels/ /tmp/wheels/

# 从本地whl文件安装所有依赖（离线安装，跳过依赖版本冲突检查）
RUN python3 -m pip install --no-cache-dir --break-system-packages \
    --no-index --find-links /tmp/wheels/ --no-deps \
    fpdf2 \
    alibabacloud_dysmsapi20170525 \
    alibabacloud_credentials \
    alibabacloud_credentials_api \
    alibabacloud_tea \
    alibabacloud_tea_openapi \
    alibabacloud_tea_util \
    alibabacloud_openapi_util \
    alibabacloud_gateway_spi \
    aiofiles \
    aiohttp \
    aiohappyeyeballs \
    aiosignal \
    attrs \
    frozenlist \
    multidict \
    yarl \
    propcache \
    darabonba_core \
    openpyxl \
    xlsxwriter \
    python-docx \
    reportlab \
    requests \
    lxml \
    certifi \
    charset_normalizer \
    idna \
    urllib3 \
    et_xmlfile \
    xlrd \
    typing_extensions \
    cryptography \
    cffi \
    apscheduler \
    pytz \
    tzlocal

# 安装weasyprint及其依赖（全部离线）
RUN python3 -m pip install --no-cache-dir --break-system-packages \
    --no-index --find-links /tmp/wheels/ --no-deps \
    weasyprint \
    pydyf \
    tinycss2 \
    cssselect2 \
    html5lib \
    pyphen \
    webencodings \
    six \
    pycparser

# 清理临时文件
RUN rm -rf /tmp/wheels/

USER 1000:1000
