Latest official opencode for autonomous CI/headless - JDK17/21+Gradle8.8+Py3.14+Node24
2.7K
The latest official opencode release (opencode-ai), packaged for fully autonomous, no-human-in-the-loop use inside pipelines and agent runners. Point your (on-prem) model at it and let it read/write/compile/run.
docker run --rm \
-e OPENCODE_QUIET=1 \
-v "$PWD:/workspace" \
-v opencode-config:/home/opencode/.config/opencode \
-v opencode-data:/home/opencode/.local/share/opencode \
n8500x/opencode \
run --format json --dangerously-skip-permissions "your task here" > opencode.jsonl
That runs the full agentic loop with zero prompts — writes files, runs shell/gradle/javac/python3, iterates, and exits. Output is one JSON event per line on stdout.
| Flag / env | Why |
|---|---|
run | Non-interactive subcommand. Never launch the bare TUI headless — it renders ANSI escapes to a non-TTY and hangs ("no output"). |
--format json | Parseable events on stdout (step_start, tool_use, text, step_finish). The default formatter is a terminal renderer and prints nothing headless. |
--dangerously-skip-permissions | Auto-approves every tool. Guarantees the loop never stalls waiting for an approval. |
OPENCODE_QUIET=1 | Clean stdout (pure JSON, no debug logs). Omit to also get --log-level=DEBUG on stderr. |
The wrapper is installed as opencode itself, so it guards every call even when the orchestrator overrides the entrypoint:
agent { docker { image 'n8500x/opencode:latest' } }
steps {
sh '''
export OPENCODE_QUIET=1
opencode run --format json --dangerously-skip-permissions \
"refactor Foo.java and run the gradle build" > opencode.jsonl
'''
}
Gate success on parsing opencode.jsonl (last step_finish / tool exit codes) — run exits 0 even when the task itself fails.
/opt/gradle. OpenJDK 21 (apt) is the default; JDK 17 is Eclipse Temurin.python3/pip) · Node 24pyright, typescript-language-server, bash-language-server, vscode-langservers-extractedripgrep, git, openssh-clientJAVA_HOMEDefaults to 21; override at runtime to switch which java/javac/gradle the agent uses (the entrypoint prepends $JAVA_HOME/bin to PATH). Gradle 8.8 runs on either.
| JDK | JAVA_HOME |
|---|---|
| 21 (default) | /usr/lib/jvm/java-21 (= /usr/lib/jvm/current) |
| 17 | /usr/lib/jvm/java-17 |
docker run --rm -e JAVA_HOME=/usr/lib/jvm/java-17 -v "$PWD:/workspace" \
n8500x/opencode run --format json --dangerously-skip-permissions "build with JDK 17"
Bring your own provider. Mount your opencode config + auth so the agent can reach your (on-prem) model:
-v opencode-config:/home/opencode/.config/opencode
-v opencode-data:/home/opencode/.local/share/opencode
/workspace — your project (working dir)./home/opencode/.config/opencode — config + auth./home/opencode/.local/share/opencode — state (persist to skip the one-time SQLite migration).OPENCODE_QUIET=1 — pass args straight through, no debug defaults.OPENCODE_FORCE_TUI=1 — override the headless-TUI guard (rarely needed).Needs a real terminal:
docker run --rm -it -v "$PWD:/workspace" \
-v opencode-config:/home/opencode/.config/opencode \
n8500x/opencode
Tags: n8500x/opencode:latest and dated YYYYMMDD-HHMM. Ships the latest official opencode-ai release (pin with --build-arg OPENCODE_VERSION=x.y.z). Earlier tags were a from-source fork build with GLM-4.7 patches; the image now tracks upstream official releases.
Content type
Image
Digest
sha256:60711c4fb…
Size
758 MB
Last updated
about 2 months ago
docker pull n8500x/opencode