Files
devcontainers/java-maven/vibe-enhance-version/Containerfile
enoch f77b2b1e99 Install oh-my-pi coding agent
- Install @oh-my-pi/pi-coding-agent globally via bun in Containerfile
- Persist agent config (~/.omp/) via compose volume (mounted at /root)
- Agent provides native Zed (ACP protocol) support
2026-06-22 20:19:55 +08:00

57 lines
2.2 KiB
Docker
Raw 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.
FROM maven:3.9-eclipse-temurin-21
# 1. 优化 APT源 (保持你原有的逻辑,但增加了错误处理的安全性)
# 注意eclipse-temurin-21 基于 Ubuntusources 路径正确
RUN sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's/http:/https:/g' /etc/apt/sources.list.d/ubuntu.sources
# 2. 安装基础工具 + SSH Server
#添加 openssh-server, locales, sudo 等开发常用包
RUN apt-get update && \
apt-get install -y \
git curl vim ripgrep unzip netcat-openbsd bash-completion \
openssh-server locales sudo wget && \
# 清理缓存以减小镜像体积
rm -rf /var/lib/apt/lists/*
# ============================
# 2. 安装 Bun 和 Opencode
# ============================
# [关键] 设置 BUN_INSTALL 到 /opt 目录,防止被 /root 挂载卷覆盖
ENV BUN_INSTALL="/opt/bun"
ENV PATH="$BUN_INSTALL/bin:$PATH"
# 安装 Bun
RUN curl -fsSL https://bun.sh/install | bash
# 使用 Bun 安装 opencode
RUN bun install -g opencode-ai
# 安装 oh-my-pi (omp) - 终端 AI 编码 agent原生支持 Zed (ACP 协议)
# 配置目录 ~/.omp/ 由 compose.yml 中 /root 挂载卷持久化
RUN bun install -g @oh-my-pi/pi-coding-agent
# 3. 配置 SSH 服务
RUN mkdir /var/run/sshd && \
# 允许 root 登录 (Zed 需要连接用户)
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
# 修复 SSH 登录后的环境变量问题
sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
# 5. 安装 Opencode (Vibe Coding 工具)
# 假设 Opencode 是一个可以通过 curl 下载的二进制文件。
# 请将下方的 URL 替换为 Opencode 的真实下载链接。
# 如果 Opencode 是 npm 包,则需要先安装 nodejs。
# 这里演示二进制安装模式:
# RUN curl -L "https://path/to/opencode-linux-x64" -o /usr/local/bin/opencode && \
# chmod +x /usr/local/bin/opencode
# 6. 设置工作目录
WORKDIR /workspace
# 7. 配置容器启动命令
# 启动 SSH 服务并挂起容器
CMD ["/bin/sh", "-c", "/usr/sbin/sshd -D"]