A patch raises a dependency of OpenCode with a known vulnerability in the image, before OpenCode releases an update.
- Alpine and its packages need no patch. Bump their pins in
src/Dockerfileand release a patch version of the image - Bun needs no patch either, OpenCode names the version it is built with and the image follows it
- Patch a dependency of OpenCode only for a known vulnerability, once the version that fixes it is released
- A patch raises a dependency within its major version, the copies of another major in
bun.lockstay as they are - Drop a dependency from the patch once an OpenCode release requires the fixed version
- Never patch the code of OpenCode, its fixes come with its releases
Every package manager runs in the image of its ARG in src/Dockerfile, nothing is installed locally. pnpm and Yarn run in the version that packageManager in package.json names.
| Lockfile | Package manager | ARG in src/Dockerfile |
|---|---|---|
go.mod |
Go | GO_IMAGE |
Cargo.lock |
Cargo | RUST_IMAGE |
composer.lock |
Composer | COMPOSER_IMAGE |
package-lock.json |
npm | NODE_IMAGE |
pnpm-lock.yaml |
pnpm 10 or later | NODE_IMAGE |
yarn.lock |
Yarn | NODE_IMAGE |
bun.lock |
Bun | BUN_IMAGE |
aube-lock.yaml |
aube | AUBE_IMAGE |
-
Raise the dependency to the version that fixes it, several at once if needed:
scripts/patch-dependencies.sh hono@4.12.9
-
Build the image and test it:
scripts/build.sh && scripts/test.sh peakimages/opencode:local -
Commit
src/patches/dependencies.patchand release a patch version of the image
The build workflow runs scripts/patch-dependencies.sh --check before it builds. It fails when the pinned OpenCode requires a raised dependency itself, or when the patch no longer applies. On the branch of the pull request that bumps OpenCode, manually write the patch again for the new release. It drops every dependency the release raises itself, and the whole file once none is left:
scripts/patch-dependencies.shImportant
A patch that no longer applies stops the build.
Drop one dependency:
scripts/patch-dependencies.sh --remove honoDrop all of them:
scripts/patch-dependencies.sh --remove