This repository contains the build configuration for brokenjade/opencode_plus, a Docker image based on ghcr.io/anomalyco/opencode with additional development tools preinstalled.
OpenCode Plus is a Docker image based on OpenCode with the following development tools preinstalled:
zshgitcurluv- Python 3.14
UV_LINK_MODE=copyconfigured by default
It is intended for running OpenCode with a local project directory mounted from your host machine. In that respect, it works similarly to a Docker sandbox.
Before starting, make sure you have:
- Docker installed and running
- A project directory to work with
OPENCODE_SERVER_USERNAMEandOPENCODE_SERVER_PASSWORDset in your terminal environment- An active internet connection
OpenCode may require internet access when starting or when performing tasks that use online services. Check your connection before launching it. In environments where required services are unreachable, including some network configurations in China, OpenCode may fail to start or work correctly.
-
In a terminal, navigate to your project directory:
cd /path/to/your/project -
Choose a host port. In the example below, OpenCode is available on port
4086. You can change this to any unused port. -
Start the container:
port=4086 && docker run -d \ --name "$(basename "$PWD")" \ -v "$(pwd):$(pwd)" \ -p "${port}:4096" \ -e OPENCODE_SERVER_USERNAME="$OPENCODE_SERVER_USERNAME" \ -e OPENCODE_SERVER_PASSWORD="$OPENCODE_SERVER_PASSWORD" \ brokenjade/opencode_plus \ web --hostname 0.0.0.0 --port 4096
or you can wrap it up into a bash function and save into ~/.aliases
docker-opencode() { # Default port to 4096 on host if no argument is provided local port="${1:-4096}" docker run -d \ --name "$(basename "$PWD")" \ -v "$(pwd):$(pwd)" \ -v "$(pwd)/.container_bk/.local/share/opencode:/root/.local/share/opencode" \ -v "$(pwd)/.container_bk/.config/opencode:/root/.config/opencode" \ -p "${port}:4096" \ -e OPENCODE_SERVER_USERNAME="$OPENCODE_SERVER_USERNAME" \ -e OPENCODE_SERVER_PASSWORD="$OPENCODE_SERVER_PASSWORD" \ brokenjade/opencode_plus web --hostname 0.0.0.0 --port 4096 } #When using it, you can simple call or a port number without it(using default 4096) docker-opencode 4088
Note: This backs up the OpenCode database to your project's .container_bk folder. It is useful for rebuilding the container from scratch without losing your OpenCode history and configurations. Additionally, OPENCODE_SERVER_USERNAME and OPENCODE_SERVER_PASSWORD are optional; if you do not want to use them, you can remove these two lines or set them up in your host environment.
-
Open OpenCode in your browser:
http://localhost:4096If you selected a different value for
port, replace4086in the URL with the port you chose.
The container name is automatically set to the name of your current project directory.
After starting the container once, return to the same project directory and restart it with:
docker restart "$(basename "$PWD")"Then open the same address in your browser:
http://localhost:4096
From the project directory, run:
docker exec -it "$(basename "$PWD")" zsh -c 'cd "'"$PWD"'"; source .venv/bin/activate; exec zsh'This opens a zsh shell inside the container, changes to your mounted project directory, and activates the project’s .venv virtual environment.
To leave the container shell, run:
exitCompared with a Docker sandbox, this image is designed to be more adaptable to a regular development workflow:
- Your current project directory is mounted directly into the container.
- You can open an interactive
zshterminal in the container at any time. - Common development tools, including Python and
uv, are already available. - You can extend the image with your own Dockerfile or add project-specific tools.
A sandbox can be convenient for isolated, temporary tasks, but it may be less suitable when you need a reusable, customized environment. In addition, Docker Sandbox image servers may be inaccessible from China due to network restrictions.
The workflow is a GitHub Actions job that:
- Triggers on a weekly schedule—Sunday at 02:00 UTC—and manually through Run workflow in the GitHub UI.
- Logs in to Docker Hub using the
DOCKERHUB_USERNAMEandDOCKERHUB_TOKENrepository secrets. - Checks whether the base image has changed by comparing the digest of
ghcr.io/anomalyco/opencodewith the recorded base-image digest label on the previously publishedbrokenjade/opencode_plus:latestimage. - Builds and pushes only when the base image has changed:
- Platforms:
linux/amd64andlinux/arm64, using QEMU and Buildx - Tags:
:latestand:<run-number> - Labels: source repository, commit SHA, and base-image digest
- Registry cache: the
buildcachetag, used for faster incremental rebuilds
- Platforms:
- Skips the rebuild and writes a log message when the base image is unchanged.
To build and publish your own customized image with this workflow, add the following secrets to the GitHub repository:
| Secret | Value |
|---|---|
DOCKERHUB_USERNAME |
Your Docker Hub username |
DOCKERHUB_TOKEN |
A Docker Hub access token, or your account password |
docker build -t brokenjade/opencode_plus:local .