Skip to content

Commit d86fdba

Browse files
committed
docs(readme): add runtime behavior section and clarify integrations
1 parent 03808d1 commit d86fdba

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

README.md

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- [Important Environment Variables](#important-environment-variables)
99
- [Verifying Authentication](#verifying-authentication)
1010
- [Azure Foundry Provider](#azure-foundry-provider)
11+
- [Runtime Behavior](#runtime-behavior)
1112
- [Working with OpenCode from the Container](#working-with-opencode-from-the-container)
1213
- [Basic Usage Pattern](#basic-usage-pattern)
1314
- [Volume Mounts Explained](#volume-mounts-explained)
@@ -27,15 +28,16 @@
2728
- [Build and Runtime Issues](#build-and-runtime-issues)
2829

2930
A containerized OpenCode CLI environment with bundled runtime tooling, provider integrations,
30-
and OpenCode skills. This image is designed to give you a ready-to-run `opencode` setup for
31-
local project work while keeping your configuration and working directory mounted from the host.
31+
and reusable OpenCode skills. The image ships with sensible defaults so you can start working in
32+
local projects quickly while still mounting your own workspace, credentials, and persisted user
33+
state from the host.
3234

3335
## Container Architecture
3436

35-
- **OpenCode entrypoint**: The container starts `opencode` directly through `entrypoint.sh`
37+
- **Prepared startup flow**: The entrypoint loads the container shell environment before launching `opencode`
3638
- **Bun-based image**: Uses `oven/bun:latest` as the base image and installs `opencode-ai`
37-
- **Mise-managed tooling**: Activates `mise` for both interactive and non-interactive shells
38-
- **Curated additions**: Bundles Azure Foundry provider support, helper tooling, and reusable skills
39+
- **Consistent shell tooling**: Uses shell bootstrap and `BASH_ENV` so command execution sees the same prepared environment
40+
- **Curated additions**: Bundles Azure Foundry support, memory/context tooling, and reusable skills
3941

4042
## Building the Container Image
4143

@@ -53,11 +55,13 @@ make build
5355

5456
### Build Arguments
5557

56-
Customize the image version and local tag as needed:
58+
Customize the main image component versions and local tag as needed:
5759

5860
```bash
5961
docker build \
6062
--build-arg OPENCODE_VERSION=latest \
63+
--build-arg AZURE_FOUNDRY_PROVIDER_VERSION=0.2.0 \
64+
--build-arg ENGRAM_VERSION=v1.9.1 \
6165
-t opencode-cli:dev .
6266
```
6367

@@ -67,10 +71,15 @@ With `make`:
6771
make build IMAGE=opencode-cli TAG=dev OPENCODE_VERSION=latest
6872
```
6973

74+
The Dockerfile also accepts `AZURE_FOUNDRY_PROVIDER_VERSION` and `ENGRAM_VERSION` if you want to
75+
override the bundled provider or memory-tooling version during a direct `docker build`.
76+
7077
## Authentication Setup
7178

72-
OpenCode configuration is stored under the container user's config directory. For practical use,
73-
mount your host home directory so configuration persists across runs.
79+
The image includes default OpenCode configuration and helper integrations so it works out of the
80+
box, but you should still mount host directories for practical day-to-day use. In most setups,
81+
mounting your host home directory lets OpenCode state, credentials, and memory-related data
82+
persist across runs.
7483

7584
Typical run pattern:
7685

@@ -84,6 +93,7 @@ docker run -it --rm \
8493
This gives the container access to:
8594

8695
- `/home/bun` for OpenCode config and any persisted credentials
96+
- `/home/bun/.local/share/opencode` through the home mount for persisted local OpenCode and memory-related state
8797
- `/work` for the project you want OpenCode to read and modify
8898

8999
### Environment File Option
@@ -113,6 +123,10 @@ Security tips:
113123
The exact variables depend on the provider configuration you use with OpenCode. This image does
114124
not hardcode credentials, so pass provider settings at runtime with `-e` or `--env-file`.
115125

126+
The image also includes default configuration under `/etc/opencode`, so most users only need to
127+
provide environment variables and volume mounts rather than build up the entire runtime setup from
128+
scratch.
129+
116130
Common patterns include:
117131

118132
- OpenAI-compatible endpoints and API keys
@@ -121,8 +135,8 @@ Common patterns include:
121135

122136
### Verifying Authentication
123137

124-
Once your configuration is mounted and any required variables are provided, verify the container
125-
starts correctly:
138+
Once your configuration is mounted and any required variables are provided, verify that the
139+
container starts correctly:
126140

127141
```bash
128142
docker run -it --rm \
@@ -132,7 +146,8 @@ docker run -it --rm \
132146
opencode-cli:dev --help
133147
```
134148

135-
If your setup is correct, OpenCode should start without configuration-related errors.
149+
If your setup is correct, the CLI should start without basic configuration errors. Use a real
150+
provider-backed command when you need to verify credentials end to end.
136151

137152
## Azure Foundry Provider
138153

@@ -143,6 +158,19 @@ This means the container is prepared for Azure Foundry-oriented OpenCode setups
143158
you to compile the provider on first run. Provider credentials and runtime configuration are still
144159
supplied by your OpenCode config and environment variables.
145160

161+
The image also bundles additional helper integrations for memory and large-context workflows, so
162+
common local coding setups can start with a useful default baseline.
163+
164+
## Runtime Behavior
165+
166+
The container does a small amount of runtime preparation before launching OpenCode:
167+
168+
- It loads the shell environment through the entrypoint before starting the CLI
169+
- It uses `BASH_ENV` so non-interactive shell commands inherit the prepared toolchain environment
170+
- It enables OpenCode experimental features by default with `OPENCODE_EXPERIMENTAL=1`
171+
172+
This helps keep CLI sessions and tool-invoked shell commands consistent inside the container.
173+
146174
## Working with OpenCode from the Container
147175

148176
For normal usage, mount both your home directory and the current project directory.
@@ -161,7 +189,7 @@ Replace `[OPENCODE_ARGS]` with the arguments supported by your installed `openco
161189

162190
### Volume Mounts Explained
163191

164-
- `-v $HOME:/home/bun`: Persists OpenCode config and other user-level state
192+
- `-v $HOME:/home/bun`: Persists OpenCode config, credentials, and memory/history data stored under the OpenCode data directory
165193
- `-v ${PWD}:/work`: Mounts your current project into the container working directory
166194
- `--env-file .env`: Supplies provider credentials and runtime settings without exposing them in shell history
167195
- `--rm`: Removes the container after the process exits
@@ -235,6 +263,11 @@ The image currently installs or bundles the following pieces during build:
235263

236264
- `opencode-ai`
237265
- `mise`
266+
- shell bootstrap for interactive and non-interactive command execution
267+
- default OpenCode configuration under `/etc/opencode`
268+
- `engram` for persisted memory-oriented workflows
269+
- `aleph` tooling for large-context local analysis workflows
270+
- local MCP-backed integrations available by default
238271
- `python`
239272
- `go`
240273
- `ripgrep`
@@ -251,7 +284,7 @@ a GitHub repository using a treeless, sparse clone workflow.
251284

252285
This repo publishes container images to GitHub Container Registry from version tags.
253286

254-
- `create-linked-release.yml` polls an upstream repository release stream and mirrors matching tags into this repo
287+
- `create-linked-release.yml` checks the latest matching upstream release on a schedule and creates a local tag when a new one appears
255288
- `build-and-deploy.yml` runs on `v*` tags, validates semver, and publishes the image to `ghcr.io/ophiosdev/opencode-cli`
256289
- Published tags include semver variants, a commit SHA tag, and `latest` when enabled for the default branch
257290

@@ -262,21 +295,23 @@ This repo publishes container images to GitHub Container Registry from version t
262295
- `git-export.py`: Sparse GitHub directory export helper
263296
- `Makefile`: Convenience targets for local image build and cleanup
264297
- `.github/workflows/`: PR validation, release sync, and registry publishing workflows
265-
- `mise.toml`: Local tool definitions for linting and validation utilities
298+
- `.mise.toml`: Local tool definitions for linting and validation utilities
266299

267300
## Development and Validation
268301

269302
The repo uses `pre-commit` for lightweight validation of committed files.
270303

271304
Configured checks include:
272305

306+
- General file hygiene checks from `pre-commit-hooks`
273307
- YAML linting with `yamllint`
274308
- Dockerfile linting with `hadolint`
275309
- Markdown linting with `markdownlint-cli2`
276310
- GitHub Actions validation with `actionlint`
277311
- Spelling checks with `typos`
278312

279-
The pull request workflow also performs a Docker build smoke test when `Dockerfile` changes.
313+
The pull request workflow always runs pre-commit checks and also performs a Docker build smoke
314+
test when `Dockerfile` changes.
280315

281316
## Troubleshooting
282317

@@ -285,6 +320,7 @@ The pull request workflow also performs a Docker build smoke test when `Dockerfi
285320
- Repeated setup prompts: ensure `-v $HOME:/home/bun` is present so config persists
286321
- Missing credentials: confirm required provider variables are passed with `-e` or `--env-file`
287322
- Startup config failures: run `opencode-cli:dev --help` first to confirm the base container starts cleanly
323+
- Memory/history not persisting: confirm your `/home/bun` mount is present so OpenCode state survives container recreation
288324

289325
### File Access Issues
290326

0 commit comments

Comments
 (0)