Installs opencode from official GitHub release assets and persists shared state across devcontainers.
"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"
}
}| Option | Type | Default | Description |
|---|---|---|---|
version |
string | latest |
Version to install. Accepts latest, 1.3.13, or v1.3.13. |
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\""
}This feature is released under the MIT License.
The installed tool is subject to its own license: opencode license.
- Add trailing slash to bind mount source paths to mark them explicitly as directories.
- Initial release.