opencode-container/README.md
Jeena b1f356c5f5 Fix problem where container home was seperate for each project dir
The problem was that we mounted `pwd` as HOME and that meant that
every time git was used it would look into the data and work for a
long time, and it would also commit everything there.

Now we have a central container-home directory in the directory
where we checked out this git repo and it is used by each session
independent of in which project directory we are.
2026-01-15 12:19:07 +09:00

42 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# opencode-container
Run OpenCode inside an Arch Linux Docker container that closely mirrors a
local development environment, while limiting access to sensitive files on
the host.
## Features
- Arch Linuxbased image
- Runs as the host user (same username, UID, GID)
- Mounts only the current project directory (same absolute path inside container)
- Persists OpenCode state in ./data directory
- No access to SSH keys, passwords, or full `$HOME`
- Simple shell function (`opencode`) to launch interactively
## Install
Change to your projects directory and clone the repository:
```
cd ~/Projects/
git clone https://git.jeena.net/jeena/opencode-container.git
```
Source the helper file `opencode.aliases` in your shell configuration
(`.bashrc` or `.zshrc`) so the `opencode` function is available in new sessions.
We set up the ./container-home directory as a central $HOME inside of the
container, independent of the session or project directory we start in. This
presists the whole $HOME from inside the container so everything opencode
writes into config files, etc. presists there.
## Usage
From any project directory:
```
opencode
```
The image is built automatically on first use if it does not already exist.
OpenCode starts inside the container with the current directory mounted and
set as the working directory.