Skip to content

Latest commit

 

History

History
69 lines (47 loc) · 1.99 KB

File metadata and controls

69 lines (47 loc) · 1.99 KB

OpenCode (opencode)

Installs opencode from official GitHub release assets and persists shared state across devcontainers.

Example Usage

"features": {
    "ghcr.io/sliekens/devcontainer-features/opencode:1": {}
}

Pin a specific version when you need deterministic builds:

"features": {
    "ghcr.io/sliekens/devcontainer-features/opencode:1": {
        "version": "1.3.13"
    }
}

Options

Option Type Default Description
version string latest Version to install. Accepts latest, 1.3.13, or v1.3.13.

Persistent State

opencode uses XDG base directories for data and configuration:

Host path Container path Purpose
~/.local/share/opencode /var/lib/opencode Data and auth credentials
~/.config/opencode /var/lib/opencode-config User configuration

These directories are bind-mounted from the host so that auth credentials and settings are preserved across container rebuilds.

Because Docker cannot bind-mount a directory that does not yet exist, consuming devcontainer.json files should add an initializeCommand to pre-create these directories on the host before the container starts:

{
    "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
    "features": {
        "ghcr.io/sliekens/devcontainer-features/opencode:1": {}
    },
    "initializeCommand": "mkdir -p \"$HOME/.local/share/opencode\" \"$HOME/.config/opencode\""
}

License

This feature is released under the MIT License.

The installed tool is subject to its own license: opencode license.

Links

Release Notes

1.0.1 - 2026-05-14

  • Add trailing slash to bind mount source paths to mark them explicitly as directories.

1.0.0 - 2026-04-01

  • Initial release.