📖 README.md

codefactory

Self-hosted OpenCode instance running on my server, reachable remotely from any laptop or phone. It is connected to my on-server git server and has access to the real Docker socket so it can build images for my Portainer + Traefik homelab stack.

What it is right now

  • OpenCode served on 0.0.0.0:80 inside a container named opencode, built from codefactory image (see .containerfile).
  • Remote access via Traefik at codefactory.xn--sberg-lra.net (external proxy network, Traefik labels on the service).
  • Authentication imported at startup from the AUTH env var.
  • Host access mounted in:
    • /var/run/docker.sock — real Docker, used to build images for Portainer + Traefik deployments (⚠️ this is the real Docker, not rootless/Dind — be careful).
    • /big/repos → /repos — my on-server git server's repos.
    • /bigger/codefactory/config → /root/.config/opencode/ — OpenCode/agent config persistence.
    • /bigger/codefactory/workspace → /code/ — working directory persistence.
  • Pre-installed SDKs in the image: Node.js 26 (via nvm), pnpm, .NET 10.0 SDK, Rust, git, curl.
  • Entrypoint: startup.sh imports OpenCode auth, then runs opencode serve.

Files

File Purpose
startup.sh Container entrypoint: imports OpenCode auth and starts opencode serve.
.containerfile Builds the codefactory image (Ubuntu + OpenCode + SDKs + Docker CLI).
docker-compose.yml Runs the opencode service with mounts, env, Traefik labels, proxy network.
README.md This file.

Status

MVP deployed. OpenCode is reachable at codefactory.xn--sberg-lra.net and can read/write repos under /repos and build Docker images via the mounted socket. Persistent config lives under /bigger/codefactory/ and includes:

  • Git config: ~/.gitconfig, SSH keys, and credentials restored from /bigger/codefactory/config/git/ on startup and persisted on shutdown.
  • OpenCode/agent config: Mounted at /root/.config/opencode/ and persisted across restarts.
  • Agent skills: Custom skills (e.g., deploy_to_portainer.md) stored in /bigger/codefactory/config/skills/ and loaded into OpenCode.

See PLAN.md for upcoming work (Docker-in-Docker for dev builds, per-project SDKs, dev-server exposure via Traefik sub-sub-domains, etc.).