Skip to content

[Feature Request] Add Docker Server Image for OpenCode Code Server #19474

@andreclaudino

Description

@andreclaudino

Summary

We propose adding official Docker images for running OpenCode as a headless server, enabling integration with external coding tools and creating a self-hosted code server environment.

Motivation

Having an official Docker image for OpenCode server would enable several use cases:

  1. Code Server Integration: Run OpenCode in a container and connect to it from VS Code, JetBrains IDEs, or other editors that support remote development
  2. Isolated Execution: Run OpenCode in an isolated environment without affecting the host system
  3. CI/CD Integration: Use OpenCode in automated pipelines and CI/CD workflows
  4. Multi-user Environments: Deploy OpenCode as a service in multi-user development environments
  5. Dev Containers: The image includes the Dev Container CLI, enabling seamless integration with VS Code Dev Containers

Proposed Solution

We have implemented Docker images with the following features:

  • Two base variants: Debian Trixie and Alpine Linux for different size/performance needs
  • Non-root user: Runs as opencode user (UID 1000) with sudo access for package installation
  • Pre-installed tools: build-essential, git, git-lfs, Bun, uv, npx, npm, node, devcontainer CLI
  • Volume mounts: Support for workspace, SSH keys, git config, and OpenCode configuration
  • Health checks: Built-in health check endpoint
  • Multi-arch support: linux/amd64 and linux/arm64

Example Usage

# Run the server
docker run -p 3000:3000 -v /path/to/workspace:/workspace ghcr.io/anomalyco/opencode:dev-debian

# With SSH keys for git
docker run -p 3000:3000 -v ~/.ssh:/home/opencode/.ssh ghcr.io/anomalyco/opencode:dev-debian

# Using docker-compose
services:
  opencode:
    image: ghcr.io/anomalyco/opencode:dev-debian
    ports:
      - "3000:3000"
    volumes:
      - ./workspace:/workspace
      - ~/.ssh:/home/opencode/.ssh
      - ~/.gitconfig:/home/opencode/.gitconfig

Documentation

Full documentation is available in multiple languages at docs/docker-server.md.

Implementation Status

A complete implementation is available in this PR including:

  • Dockerfiles for both Debian and Alpine variants
  • GitHub Actions workflow for automated builds to GHCR
  • Build script for local development
  • Comprehensive documentation in 22 languages

Tags

The images will be published with the following tags:

  • ghcr.io/anomalyco/opencode:<version>-debian
  • ghcr.io/anomalyco/opencode:<version>-alpine
  • ghcr.io/anomalyco/opencode:latest-debian
  • ghcr.io/anomalyco/opencode:latest-alpine

This issue is associated with PR #.

Metadata

Metadata

Assignees

Labels

docsneeds:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions