HUB
Sign inSign up
opencode logo

swaleio/opencode

By swaleio

•Updated 1 day ago

OpenCode, run unattended in Swale workflows. Backs the opencode task.

Image
0

84

swaleio/opencode repository overview

⁠opencode

Swale-built image backing the opencode task definition. It runs OpenCode⁠, the open-source coding agent, once and unattended in a directory the caller names, and emits the agent's final answer as a task output.

  • Base: node:24-trixie-slim
  • Installed: OpenCode's Linux x64 build, from the npm package @opencode/cli-linux-x64, at the version pinned in the Dockerfile⁠, plus git and ripgrep
  • User: non-root swale (uid 1000)
  • Updates: off, in the system configuration /etc/opencode/opencode.json, which outranks every other configuration file
  • WORKDIR /mnt/workspace, ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

⁠Invocation

The entrypoint takes no arguments. It reads the task's inputs from the platform's INPUT_* environment variables, writes the run's user configuration to the per-task home directory, changes into INPUT_DIRECTORY and runs opencode run --standalone --auto with the prompt as one argument and stdin closed:

Input envEffect
INPUT_PROMPTThe instructions, passed as a single argument. Required.
INPUT_DIRECTORYThe full path the agent works in. Required.
INPUT_MODELThe model as provider/model, such as anthropic/claude-haiku-5-5. With INPUT_BASE_URL, the name that server gives the model. Required.
INPUT_API_KEYThe provider's key, which the configuration reads from the environment. Pass a secret.
INPUT_BASE_URLWhen set, a provider for a server that speaks OpenAI's chat completions API.
INPUT_PERMISSION--auto approves every request nothing denies. read: edits and commands denied. edit (default): commands denied. full: nothing denied. The denials are policies in the user configuration, which a repository's own configuration cannot lift.
INPUT_RESULT_PATHWhen set, the final answer is also written to this file.
INPUT_MAX_MINUTESThe run stops after this many minutes (default 60) and the task fails.

The model must name its provider unless INPUT_BASE_URL is set, and a policy makes that provider the only one OpenCode may use: it would otherwise fall back to a model its own vendor picks.

⁠Output

After a successful run, the entrypoint appends

result=<the final answer as a JSON string>

to $WORKFLOW_TASK_OUTPUT. The consuming task must declare a result output.

⁠Tags

Each tag is the version of OpenCode the image packages, such as 2.4.3. A rebuild that keeps that version, to pick up a fixed base image or wrapper, adds -r1, -r2, and so on. A tag is never reused; latest follows the newest publish.

⁠Building

From the repository root:

docker build -t swaleio/opencode:dev images/opencode

Merging a change under images/opencode publishes the image under its next tag; task definitions reference it by digest.


Built from images/opencode⁠ in the swaleio/task-definitions⁠ repository. For how a task definition references an image, see the task definition reference⁠ in the Swale documentation⁠.

OpenCode is a product of Anomaly. This image is built by Swale, which is not affiliated with the OpenCode team; Anomaly does not build, endorse or support it.

The Dockerfile and entrypoint are covered by the MIT License⁠. OpenCode is MIT-licensed; its license is inside the image in /usr/share/licenses/opencode. Bun, whose runtime is built into OpenCode's binary, is MIT-licensed too; its license, which also lists the libraries Bun builds in, is in /usr/share/licenses/bun.

This image also contains software from other projects, each under its own license. The license texts those projects ship are inside the image: /usr/share/doc/<package>/copyright for Debian packages and /usr/local/LICENSE for Node.js. Source code for its GPL and LGPL components:

  • Debian packages: https://snapshot.debian.org/package/<source-package>/<version>/
  • JavaScriptCore (WebKit) and TinyCC, which Bun builds into the OpenCode binary: Bun's source at https://github.com/oven-sh/bun/tree/bun-v<version>, where <version> is the Bun version OpenCode's package.json names, and Bun's WebKit at https://github.com/oven-sh/WebKit⁠

We also provide that source code on request: see Third-party software⁠.

Tag summary
Recent tags
Content type
Image
Digest
sha256:82bbb1298…
Size
245.8 MB
Last updated
1 day ago
docker pull swaleio/opencode:latest