diff --git a/docker/terminal.Dockerfile b/docker/terminal.Dockerfile index c97f103..6ed1f5f 100644 --- a/docker/terminal.Dockerfile +++ b/docker/terminal.Dockerfile @@ -4,6 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive \ LANG=en_US.UTF-8 \ LC_ALL=en_US.UTF-8 +# 1. 安装系统工具与运行时库 RUN apt-get update && \ apt-get install -y --no-install-recommends \ bash \ @@ -18,15 +19,54 @@ RUN apt-get update && \ unzip \ locales \ tzdata \ - iputils-ping && \ + iputils-ping \ + # Office 转换 + libreoffice \ + pandoc \ + poppler-utils \ + # 图片/视频/媒体 + imagemagick \ + ffmpeg \ + # OCR + tesseract-ocr \ + tesseract-ocr-chi-sim \ + tesseract-ocr-chi-tra \ + # 网页截图 / 自动化 + chromium \ + # 开发辅助工具 + jq \ + ripgrep \ + fd-find \ + tree \ + # 字体 + fonts-noto-cjk \ + fonts-noto-color-emoji \ + fonts-liberation && \ sed -i 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen && \ locale-gen && \ rm -rf /var/lib/apt/lists/* +# 2. 允许 ImageMagick 处理 PDF(默认被安全策略禁止) +RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \ + sed -i 's///g' /etc/ImageMagick-6/policy.xml; \ + fi + +# 3. 安装 Node.js 20 LTS(复用 curl,已在上方安装) +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ + apt-get install -y --no-install-recommends nodejs && \ + rm -rf /var/lib/apt/lists/* && \ + node --version && \ + npm --version + +# 3.5 全局安装 office skill 需要的 Node 包 +RUN npm install -g docx pptxgenjs && \ + npm cache clean --force + WORKDIR /opt/workspace COPY docker/toolbox-requirements.txt /tmp/toolbox-requirements.txt +# 4. 创建 Python 虚拟环境并安装依赖 RUN python -m venv /opt/agent-venv && \ /opt/agent-venv/bin/pip install --no-cache-dir --upgrade pip && \ /opt/agent-venv/bin/pip install --no-cache-dir -r /tmp/toolbox-requirements.txt && \ @@ -34,3 +74,5 @@ RUN python -m venv /opt/agent-venv && \ ENV AGENT_TOOLBOX_VENV=/opt/agent-venv ENV PATH="/opt/agent-venv/bin:${PATH}" +ENV NODE_PATH="/usr/lib/node_modules" + diff --git a/docker/toolbox-requirements.txt b/docker/toolbox-requirements.txt index 8edd13b..3cee4e5 100644 --- a/docker/toolbox-requirements.txt +++ b/docker/toolbox-requirements.txt @@ -16,3 +16,9 @@ openpyxl==3.1.5 python-pptx==1.0.2 pdfplumber==0.11.4 PyPDF2==3.0.1 +# office skill 运行必需 +defusedxml +markitdown[docx] +# OCR / PDF 转图片 +pytesseract +pdf2image