Files
devcontainers/java-maven/vibe-enhance-version/Containerfile
enoch a2eba73cef Install opencode and omp with Bun
- Combine Bun installs for opencode-ai and @oh-my-pi/pi-coding-agent
- Make Makefile include .env optional and silence sed errors
2026-06-22 20:33:01 +08:00

47 lines
1.8 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 与 oh-my-pi (omp)
# - opencode: Vibe Coding 工具
# - omp: 终端 AI 编码 agent原生支持 Zed (ACP 协议)
# 配置目录 ~/.omp/ 由 compose.yml 中 /root 挂载卷持久化
RUN bun install -g opencode-ai @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
# 4. 设置工作目录
WORKDIR /workspace
# 5. 配置容器启动命令
# 启动 SSH 服务并挂起容器
CMD ["/bin/sh", "-c", "/usr/sbin/sshd -D"]