| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A containerized OpenCode CLI environment with bundled runtime tooling, provider integrations, and reusable OpenCode skills. The image ships with sensible defaults so you can start working in local projects quickly while still mounting your own workspace, credentials, and persisted user state from the host.
Build from the provided Dockerfile:
docker build -t opencode-cli:dev .You can also use the included Makefile:
make buildCustomize the main image component versions and local tag as needed:
docker build \
--build-arg OPENCODE_VERSION=latest \
--build-arg AZURE_FOUNDRY_PROVIDER_VERSION=0.2.0 \
--build-arg ENGRAM_VERSION=v1.9.1 \
-t opencode-cli:dev .With make:
make build IMAGE=opencode-cli TAG=dev OPENCODE_VERSION=latestThe Dockerfile also accepts AZURE_FOUNDRY_PROVIDER_VERSION and ENGRAM_VERSION if you want to override the bundled provider or memory-tooling version during a direct docker build.
The image includes default OpenCode configuration and helper integrations so it works out of the box, but you should still mount host directories for practical day-to-day use. In most setups, mounting your host home directory lets OpenCode state, credentials, and memory-related data persist across runs.
Typical run pattern:
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
opencode-cli:devThis gives the container access to:
If you already authenticated with gemini-cli on the host, the container can reuse that login automatically.
At startup, entrypoint.sh checks whether ~/.gemini/oauth_creds.json exists inside the container. If it does, the Bun script convert-gemini.auth.ts converts that Gemini OAuth state into OpenCode's auth store at ~/.local/share/opencode/auth.json.
Typical run pattern:
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
opencode-cli:devWith that home-directory mount:
Notes:
If you do not already have reusable Gemini CLI credentials on the host, you can authenticate manually from inside the container with the opencode-gemini-auth plugin.
Start the container with a bash shell instead of the normal entrypoint:
docker run -it --rm \
--entrypoint bash \
-v $HOME:/home/bun \
-v ${PWD}:/work \
opencode-cli:devThen run the login flow manually inside the container:
opencode auth loginIn the OpenCode prompt flow:
If you are running the container in an environment where the browser callback cannot be completed automatically, use the fallback flow described by the plugin and paste the redirected callback URL or authorization code when prompted.
After successful login, the credential is stored in your mounted home directory under OpenCode's data path, so future container runs can reuse it:
Once this has been done once, subsequent normal container starts can use the stored OpenCode auth directly, without repeating the manual login flow.
If your OpenCode setup depends on provider-specific environment variables, keep them in a local env file instead of placing secrets directly on the command line.
install -m 600 /dev/null .env
${EDITOR:-vi} .env
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:devSecurity tips:
The exact variables depend on the provider configuration you use with OpenCode. This image does not hardcode credentials, so pass provider settings at runtime with -e or --env-file.
The image also includes default configuration under /etc/opencode, so most users only need to provide environment variables and volume mounts rather than build up the entire runtime setup from scratch.
Common patterns include:
Once your configuration is mounted and any required variables are provided, verify that the container starts correctly:
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:dev --helpIf your setup is correct, the CLI should start without basic configuration errors. Use a real provider-backed command when you need to verify credentials end to end.
The image builds and installs the azure-foundry-provider package during the Docker build and places the compiled provider under /usr/local/provider/azure-foundry-provider.
This means the container is prepared for Azure Foundry-oriented OpenCode setups without requiring you to compile the provider on first run. Provider credentials and runtime configuration are still supplied by your OpenCode config and environment variables.
The image also bundles additional helper integrations for memory and large-context workflows, so common local coding setups can start with a useful default baseline.
The container does a small amount of runtime preparation before launching OpenCode:
This helps keep CLI sessions and tool-invoked shell commands consistent inside the container.
For normal usage, mount both your home directory and the current project directory.
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:dev [OPENCODE_ARGS]Replace [OPENCODE_ARGS] with the arguments supported by your installed opencode-ai version.
The container runs in /work, which maps to your current host directory. This means:
Start an interactive OpenCode session in the current project:
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:devRun a one-off command such as help or version output:
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:dev --versionIf you want to keep project-local settings, create a dedicated env file and reuse it:
install -m 600 /dev/null .env
${EDITOR:-vi} .env
docker run -it --rm \
-v $HOME:/home/bun \
-v ${PWD}:/work \
--env-file .env \
opencode-cli:dev --helpCreate a short alias for daily use:
# Add to your ~/.bashrc or ~/.zshrc
alias opencodec='docker run -it --rm -v $HOME:/home/bun -v ${PWD}:/work --env-file .env opencode-cli:dev'
# Then use simply:
opencodec --help
opencodecThe build bundles these tools and skills:
The repository also includes git-export.ts, a Bun helper script that exports a single directory from a GitHub repository using a treeless, sparse clone workflow.
This repo publishes container images to GitHub Container Registry from version tags.
The repo uses pre-commit for lightweight validation of committed files.
Configured checks include:
The pull request workflow always runs pre-commit checks and also performs a Docker build smoke test when Dockerfile changes.
| Back | FazBrowse Home | New Git URL |