Fix opencode not found: symlink installer binary to /usr/local/bin
The opencode curl installer puts the binary in /root/.local/bin which isn't on PATH for the nextjs user. Add a symlink to /usr/local/bin after install. Also ensure /usr/local/bin is always in the PATH passed to spawned agent processes.
This commit is contained in:
@@ -42,6 +42,8 @@ RUN apk add --no-cache git github-cli curl ca-certificates
|
|||||||
RUN npm install -g @anthropic-ai/claude-code @openai/codex
|
RUN npm install -g @anthropic-ai/claude-code @openai/codex
|
||||||
RUN curl -fsSL https://opencode.ai/install | sh || \
|
RUN curl -fsSL https://opencode.ai/install | sh || \
|
||||||
echo "WARN: opencode install failed, skipping"
|
echo "WARN: opencode install failed, skipping"
|
||||||
|
# Ensure opencode is on PATH (installer puts it in ~/.local/bin)
|
||||||
|
RUN if [ -f /root/.local/bin/opencode ]; then ln -s /root/.local/bin/opencode /usr/local/bin/opencode; fi
|
||||||
|
|
||||||
# MCP servers: Gitea (Go binary from builder stage)
|
# MCP servers: Gitea (Go binary from builder stage)
|
||||||
COPY --from=gitea-mcp-builder /usr/local/bin/gitea-mcp /usr/local/bin/gitea-mcp
|
COPY --from=gitea-mcp-builder /usr/local/bin/gitea-mcp /usr/local/bin/gitea-mcp
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ export async function buildAgentEnv(
|
|||||||
): Promise<NodeJS.ProcessEnv> {
|
): Promise<NodeJS.ProcessEnv> {
|
||||||
const env: NodeJS.ProcessEnv = { ...process.env, TERM: "xterm-256color" };
|
const env: NodeJS.ProcessEnv = { ...process.env, TERM: "xterm-256color" };
|
||||||
|
|
||||||
|
// Ensure global bin paths are available (npm -g, opencode installer)
|
||||||
|
const path = env.PATH || "/usr/local/bin:/usr/bin:/bin";
|
||||||
|
if (!path.includes("/usr/local/bin")) {
|
||||||
|
env.PATH = `/usr/local/bin:${path}`;
|
||||||
|
}
|
||||||
|
|
||||||
const providersToInject =
|
const providersToInject =
|
||||||
config.runtime === "opencode"
|
config.runtime === "opencode"
|
||||||
? Object.keys(PROVIDER_ENV_VARS)
|
? Object.keys(PROVIDER_ENV_VARS)
|
||||||
|
|||||||
Reference in New Issue
Block a user