# contained/agent-opencode — OpenCode on top of the Contained base image.
# Built automatically on the first start of a sandbox that uses it (and
# rebuilt when this file changes), or by hand:
#   docker build -t contained/agent-opencode:latest build/agents/opencode
FROM contained/agent-base:latest

# The base image sets HOME to the agent's home; root's install steps must
# not write there (OpenCode's installer would leave root-owned folders the
# agent cannot use).
USER root
ENV HOME=/root
# Pinned like the base image; raise it here.
ARG OPENCODE_VERSION=1.18.32
RUN npm install -g opencode-ai@${OPENCODE_VERSION}
ENV HOME=/home/node
USER node
