Sign inSign up

n8500x/opencode

By n8500x

Updated about 2 months ago

Latest official opencode for autonomous CI/headless - JDK17/21+Gradle8.8+Py3.14+Node24

Image
0

2.7K

n8500x/opencode repository overview

opencode — autonomous coding agent for CI

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.

TL;DR — run an autonomous task

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.

The three flags that matter

Flag / envWhy
runNon-interactive subcommand. Never launch the bare TUI headless — it renders ANSI escapes to a non-TTY and hangs ("no output").
--format jsonParseable events on stdout (step_start, tool_use, text, step_finish). The default formatter is a terminal renderer and prints nothing headless.
--dangerously-skip-permissionsAuto-approves every tool. Guarantees the loop never stalls waiting for an approval.
OPENCODE_QUIET=1Clean stdout (pure JSON, no debug logs). Omit to also get --log-level=DEBUG on stderr.

Use as a Jenkins agent image

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.

Batteries included (no runtime downloads)

  • JDK 21 + JDK 17 + Gradle 8.8 at /opt/gradle. OpenJDK 21 (apt) is the default; JDK 17 is Eclipse Temurin.
  • Python 3.14 (python3/pip) · Node 24
  • LSP servers on PATH: pyright, typescript-language-server, bash-language-server, vscode-langservers-extracted
  • ripgrep, git, openssh-client
Pick the JDK with JAVA_HOME

Defaults 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.

JDKJAVA_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"

Model / config

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

Mounts & env

  • /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).

Interactive TUI (optional)

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.

Tag summary

Content type

Image

Digest

sha256:60711c4fb

Size

758 MB

Last updated

about 2 months ago

docker pull n8500x/opencode