From a849d0b3de7b9dc6e6fa9a3b9eb45341989b2431 Mon Sep 17 00:00:00 2001 From: "tao.chen" <93983997+taochen-ct@users.noreply.github.com> Date: Thu, 18 Jun 2026 14:04:39 +0800 Subject: [PATCH] update Dockerfile --- Dockerfile | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 138feaf..081bcef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,11 +32,19 @@ FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive +# 安装 ripgrep 工具 +COPY ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz /tmp/ +RUN tar -xzf /tmp/ripgrep-15.1.0-x86_64-unknown-linux-musl.tar.gz -C /opt && \ + ln -s /opt/ripgrep-15.1.0-x86_64-unknown-linux-musl/rg /usr/local/bin/rg +RUN rg --version + + # 1. 干净地为最终镜像配置 Node.js 22 环境 RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ gnupg \ + git \ && mkdir -p /etc/apt/keyrings \ && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ @@ -48,16 +56,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # 2. 从 builder 复制 uv 和由 uv 管理的 Python 3.11 COPY --from=builder /opt/uv/uv /usr/local/bin/uv COPY --from=builder /root/.local/share/uv/python /root/.local/share/uv/python +RUN uv --version +RUN uv venv /opt/venv --python 3.11 +ENV PATH="/opt/venv/bin:$PATH" +COPY requirements.txt /tmp/requirements.txt +RUN uv pip install \ + --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \ + --requirements /tmp/requirements.txt -# 3. 核心修复:在最终镜像中用正规的 npm 安装 opencode-ai,确保系统全局软链接生成完整 +# 3. 在最终镜像中用正规的 npm 安装 opencode-ai,确保系统全局软链接生成完整 RUN npm install -g opencode-ai && npm cache clean --force +RUN opencode --version -# 4. 精准寻找 uv 的 Python 路径并建立全局 python / python3 软链接(消除通配符失败隐患) -RUN UV_PYTHON_BIN=$(ls /root/.local/share/uv/python/cpython-3.11.*/bin/python3 | head -n 1) \ - && ln -s "$UV_PYTHON_BIN" /usr/local/bin/python3 \ - && ln -s /usr/local/bin/python3 /usr/local/bin/python - -# 5. 验证成果 -RUN opencode --version && uv --version && python3 --version +COPY skills /root/.config/opencode/skills ENTRYPOINT ["opencode"]