first commit

This commit is contained in:
Ian
2026-09-28 23:17:45 +02:00
commit 3e2c12d73d
6 changed files with 417 additions and 0 deletions
+125
View File
@@ -0,0 +1,125 @@
# OpenCode Podman Dev Environment
Podman-based Ubuntu 26.04 development container for OpenCode.
## Decisions
- Ubuntu 26.04, amd64/x86_64
- OpenCode pinned to 1.18.32
- Node.js 24.21.0 LTS, official Linux x64 binary
- OpenJDK 11 + 17, Java 17 default
- Python 3 from Ubuntu + pip + venv
- Maven, no Gradle
- Neovim installed with no custom configuration
- non-root `dev` user
- rootless Podman with `--userns=keep-id`
- no Podman/Docker socket
- no proxy configuration
- SSH only for Git; host `.ssh` is read-only and host SSH agent is forwarded when available
- host timezone and locale
- custom CA certificates are host-mounted read-only and installed at runtime; invalid certs warn and do not stop startup
- OpenCode config/data/cache and development caches persist on the host
- Bash history is ephemeral
## Host data
The scripts create automatically:
```text
~/dev/opencode-dev/
├── opencode-config/
├── opencode-data/
├── opencode-cache/
├── m2/
├── npm-cache/
├── pip-cache/
├── certs/
├── bash/
└── projects/
```
OpenCode stores provider credentials in `~/.local/share/opencode/auth.json`, which is therefore persisted by the `opencode-data` mount.
## Build
```bash
chmod +x build.sh dev.sh opencode.sh
./build.sh
```
Clean rebuild:
```bash
./build.sh --no-cache
```
Intentional update rebuild:
```bash
./build.sh --update
```
## Shell
```bash
./dev.sh
```
Start in a project:
```bash
./dev.sh ~/dev/opencode-dev/projects/my-project
```
The same `projects` tree is mounted as `/workspace`.
Optional additional mount:
```bash
./dev.sh ~/dev/opencode-dev/projects/my-project \
--mount "$HOME/another-project:/extra"
```
Put custom Bash settings in:
```text
~/dev/opencode-dev/bash/bashrc
```
They are loaded after the image's normal Bash environment. History remains ephemeral.
## OpenCode
```bash
./opencode.sh
```
Or start in a project:
```bash
./opencode.sh ~/dev/opencode-dev/projects/my-project
```
Arguments are forwarded to OpenCode:
```bash
./opencode.sh ~/dev/opencode-dev/projects/my-project --help
```
## Persistent mounts
| Host | Container | Mode |
|---|---|---|
| `opencode-config` | `~/.config/opencode` | RW |
| `opencode-data` | `~/.local/share/opencode` | RW |
| `opencode-cache` | `~/.cache/opencode` | RW |
| `m2` | `~/.m2` | RW |
| `npm-cache` | `~/.npm` | RW |
| `pip-cache` | `~/.cache/pip` | RW |
| `certs` | `/host-certs` | RO |
| `~/.gitconfig` | `~/.gitconfig` | RO |
| `~/.ssh` | `~/.ssh` | RO |
| `bash` | `/host-bash` | RO |
| `projects` | `/workspace` | RW |
No credentials or personal OpenCode state are baked into the image.