Files
2026-08-14 23:41:57 +08:00

57 lines
2.6 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# pigo 协作镜像(单 agent 版)
#
# 构建(在仓库根目录执行,先本地交叉编译 pigo,再 docker build):
# $env:GOOS="linux"; $env:CGO_ENABLED="0"
# go build -trimpath -ldflags="-s -w" -o coop/tmp/pigo-linux-amd64 ./cmd/pigo
# docker build -f coop/Dockerfile -t pigo-coop .
# 或直接用 Linux 的 Go 工具链时跳过交叉编译步骤。
#
# 运行示例(模型后端由外部调用方通过环境变量传入):
# docker run --rm \
# -e MODEL=deepseek-chat \
# -e BASE_URL=https://api.deepseek.com \
# -e API_KEY=<your-key> \
# -e TASK="请为 XX 编写设计文档并实现原型" \
# -e ROUND_MAX=6 \
# pigo-coop
#
# 协作方式:单个 pigo 进程在工作区 /blackboard/workspace 内完成 task.md 的任务,
# 用 --resume 保持跨轮连续上下文;完成时通过 blackboard 工具创建 DONE
# supervisor 把结果以结构化 JSON/blackboard/result.json)落盘。
#
# 基础镜像复用本机已有的 pigo-worker:latestAlpine,已含 bash/git/wget/flock/
# timeout/CA 证书与静态 pigo 二进制),这里仅覆盖 pigo 二进制为新代码(含
# blackboard 工具)并加入 supervisor 与协作 prompt,避免重新拉取 golang/alpine。
FROM pigo-worker:latest
# solve/pentest tools: base image only ships busybox (no curl/python3), add them here.
# pigo-worker 镜像 USER=agentRUN 层以非 root 执行,apk 无法锁库,先切 root 再恢复。
USER root
RUN apk add --no-cache curl wget python3 py3-pip jq openssl
# Python 常用库:网络/加密/数据/解析等,覆盖多数协作与 CTF 场景。
# 使用清华 PyPI 镜像加速国内构建;--no-cache-dir 避免膨胀镜像。
# --break-system-packagesAlpine 3.20+ 标记 externally-managedpip 全局安装需显式放行。
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
USER agent
# 覆盖 pigo 二进制:coop/tmp/pigo-linux-amd64 由本地 Go 交叉编译(GOOS=linux CGO_ENABLED=0)。
# legacy builder 不支持 COPY --chmod(需 BuildKit)。权限位由主机侧 chmod 提供(构建前先 chmod 755)。
COPY coop/tmp/pigo-linux-amd64 /usr/local/bin/pigo
COPY coop/supervisor.sh /usr/local/bin/supervisor.sh
COPY coop/prompts /prompts
COPY coop/AGENTS.md /prompts/AGENTS.md
WORKDIR /blackboard
ENTRYPOINT ["/usr/local/bin/supervisor.sh"]