first commit
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# pi 协作镜像(单 agent 版,与 blackboard 协议适配)
|
||||
#
|
||||
# 构建(在仓库根目录执行,构建上下文为 pi-coop/ 目录):
|
||||
# cd /mnt/e/Code/Go/awesomeProject/agent
|
||||
# DOCKER_BUILDKIT=0 docker build -f pi-coop/Dockerfile -t pi-coop pi-coop/
|
||||
#
|
||||
# 基础镜像用 node:22-alpine(自带 node 22 + npm,满足 pi >=22.19 要求)。
|
||||
# 在其上装系统工具(curl/wget/git/jq/openssl/ripgrep)和 python3 + 常用库,
|
||||
# 再全局安装 pi coding agent,最后放入协作组件(extension/supervisor/prompts)。
|
||||
|
||||
FROM node:22-alpine
|
||||
|
||||
# ---- 系统工具 + Python ----
|
||||
# 先把 apk 源换成清华镜像并用 http(node:22-alpine 的 Alpine 3.24 用官方 CDN
|
||||
# 拉 APKINDEX 会报 TLS: unspecified error,改 http 绕过;装上 ca-certificates 后
|
||||
# TLS 即恢复正常)。之后 apk add 装系统工具 + python3。
|
||||
RUN sed -i 's|https://dl-cdn.alpinelinux.org|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apk/repositories \
|
||||
&& apk add --no-cache \
|
||||
bash ca-certificates git ripgrep \
|
||||
curl wget jq openssl file \
|
||||
python3 py3-pip
|
||||
|
||||
# ---- Python 常用库 ----
|
||||
# 用清华 PyPI 镜像加速;--no-cache-dir 避免膨胀;--break-system-packages 放行 Alpine pip 全局安装。
|
||||
RUN pip3 install --no-cache-dir --break-system-packages \
|
||||
-i https://pypi.tuna.tsinghua.edu.cn/simple \
|
||||
requests urllib3 certifi idna charset-normalizer \
|
||||
cryptography pyOpenSSL paramiko pyjwt \
|
||||
PyYAML beautifulsoup4 lxml \
|
||||
python-dotenv click tqdm \
|
||||
numpy pandas \
|
||||
httpx aiohttp websockets dnspython \
|
||||
psutil pillow
|
||||
|
||||
# ---- 全局安装 pi coding agent ----
|
||||
# --ignore-scripts 跳过 lifecycle script(pi 官方推荐,dist 已预编译)。
|
||||
# 使用 npmmirror 镜像加速国内下载。
|
||||
RUN npm install -g --ignore-scripts \
|
||||
--registry=https://registry.npmmirror.com \
|
||||
@earendil-works/pi-coding-agent@latest
|
||||
|
||||
# ---- 协作组件 ----
|
||||
# extension 放 /extensions,supervisor 与 prompts 放默认路径。
|
||||
RUN mkdir -p /extensions /prompts /blackboard
|
||||
COPY coop.ts /extensions/coop.ts
|
||||
COPY supervisor.sh /usr/local/bin/supervisor.sh
|
||||
COPY AGENTS.md /prompts/AGENTS.md
|
||||
COPY prompts /prompts
|
||||
RUN chmod +x /usr/local/bin/supervisor.sh
|
||||
|
||||
# ---- 非 root 用户 ----
|
||||
# node:22-alpine 自带 node 用户(uid 1000),直接复用,与 pigo-coop 的 uid 1000 对齐,
|
||||
# 便于 blackboard 挂载卷权限一致。把协作目录所有权交给 node。
|
||||
RUN chown -R node:node /extensions /prompts /blackboard
|
||||
USER node
|
||||
WORKDIR /blackboard
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/supervisor.sh"]
|
||||
Reference in New Issue
Block a user