Fix opencode not found: symlink installer binary to /usr/local/bin
All checks were successful
CI / lint-and-test (push) Successful in 34s
Deploy Production / deploy (push) Successful in 1m30s
CI / build (push) Successful in 1m51s

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:
Julia McGhee
2026-03-21 22:10:13 +00:00
parent 0906efe60e
commit bf67446480
2 changed files with 8 additions and 0 deletions

View File

@@ -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 curl -fsSL https://opencode.ai/install | sh || \
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)
COPY --from=gitea-mcp-builder /usr/local/bin/gitea-mcp /usr/local/bin/gitea-mcp

View File

@@ -14,6 +14,12 @@ export async function buildAgentEnv(
): Promise<NodeJS.ProcessEnv> {
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 =
config.runtime === "opencode"
? Object.keys(PROVIDER_ENV_VARS)