Skip to content

Conversation

@didier-durand
Copy link
Contributor

@didier-durand didier-durand commented Jan 20, 2026

Issue fixed

#9562

How did you verify your code works?

The image build executed successfully on my clone of this repo in the branch used to submit this PR: see https://github.com/didier-durand/opencode/actions/runs/21161964252/job/60858222994

The container registry was successfully created on my clone: https://github.com/didier-durand/opencode/pkgs/container/opencode.

The built image runs fine on my MacOS laptop:
image

What does this PR do?

This PR mostly delivers a full-stack Docker image (based on Debian Trixie official image) for Opencode to operate
consistently across multiple environments (developer laptop, on-prem K8s pod, cloud service like AWS ECS or GCP Run
functions). Having such an image avoid setup issues in new environments and fosters repeatability across those environments

Running in Docker, Opencode still works fine with Ghostty or Alacritty.
To try the image interactively, just run in Ghostty:
docker run -it ghcr.io/didier-durand/opencode-vibe:latest opencode --log-level INFO --model opencode/glm-4.7-free --prompt 'who are you?'

To try the build locally: docker build --no-cache --tag opencode:latest .
To run the locally built image: docker run -it opencode:latest opencode --log-level INFO --model opencode/glm-4.7-free --prompt 'who are you?'

This image is fully validated in the GitHub worklfow after its build with a very similar command using opencode run with same free model.
You can see multiple executions of this workflow in repo opencode-vibe

The image embarks OpenTelemetry collector to make the Opencode agents fully observable (logs, trace spans,
metrics) as enabled by Vercel's AI SDK which is leveraged by Opencode. In our own use cases, we heavily leverage
OpenTelemetry observability with Dash0 service as backend.

Screenshot 2026-01-20 at 07 10 24

Here is an example with Opencode logs

The deliverables of the PRare:

  • The Dockerfile
  • The YAML of GitHub workflow
  • The config file for OpenTelemetry collector
  • The directive file for [Hadolint]https://github.com/hadolint/hadolint) to check the Dockerfile

The Dockerfile will:

  1. update the Trixie image to the last version for all packages
  2. add additional packages like curl, jq, etc. that LLMs tend to use to install tools, analyze code
  3. install Python (currently 3.13) and uv package manager as LLMs often generate Python scripts and instruct agents to run those when they
    realize that running a generated ad hoc script will prove more efficient than a ton of tool calls
  4. install OpenTelemetry collector and its community contributions (to obtain filelog). The use of filelog contrib
    will allow the upload of Opencode log files to OpenTelemetry backend (see screenshot above)
  5. install Opencode with its config and its extensions in .opencode directory
  6. create a opencode user to have a proper home directory to host .opencode directory and other config files
  7. create a start bash shell using the WITH_OTEL env var to be supplied at run time by docker run command to activate OpenTelemetry or not

The GitHub workflow will:

  1. run every 12h to cope with rapid evolution pace of Opencode
  2. validate the Dockerfile via Hadolint and the Opencode config file against official Opencode schema via check-jsonschema
  3. prepare the tags for the image to be built
  4. build a new Docker image of full-stack Opencode with the last version pushed to NPM official registry
  5. push this image to a GitHub container registry named after the repository name, i.e. ghcr.io/anomalyco/opencode in this case

Finally, the workflow will:

  1. download the newly created image
  2. validate executions Opencode will run under created user opencode
  3. check that the version of Opencode installed in container matches the one used at built time
  4. validate that the Opencode agent runs properly via the execution of a simple prompt as a docker run command leveraging a free Opencode model:
    `docker exec "$CONTAINER_NAME" opencode run --log-leve

@github-actions
Copy link
Contributor

Hey! Your PR title Debian-based full-stack Opencode Docker image with OpenTelemetry for … doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate PRs Found

PR #5245: feat: integrate OpenTelemetry

  • Related because it addresses OpenTelemetry integration into Opencode, which is a core component in the Docker image being proposed.

PR #6629: feat(telemetry): add OpenTelemetry instrumentation with Aspire Dashboard support

Note: These PRs address OpenTelemetry integration at the core Opencode level, while PR #9560 focuses on containerizing Opencode with OpenTelemetry collector support. However, they may warrant review to ensure the Docker image approach aligns with or complements existing observability work.

@didier-durand didier-durand changed the title Debian-based full-stack Opencode Docker image with OpenTelemetry for … feat: Debian-based full-stack Opencode Docker image (incl. OpenTelemetry) with GitHub build workflow for … Jan 20, 2026
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@didier-durand
Copy link
Contributor Author

Created an issue describing what we want to solve and added it to this PR

@didier-durand
Copy link
Contributor Author

This PR isn't a duplicate of any currently existing ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant