Pi Containerized
Run Pi in a container! This is a template to containerize Pi so you can get work done without worrying about naughty agents. This setup also prevents Pi from modifying .git/, so you can always get back your files.
Design choices:
- A single persistent container runs in the background.
- Your current directory is bind-mounted to
/workspace. .gitis shadowed by a tmpfs mount: reads work, writes are discarded.- Pi session state and config are stored on a tmpfs at
/tmp/piinside the container and discarded when the container stops - NPM_CONFIG_CACHE stored in /tmp/npm-cache, prevents Pi from polluting project when it uses e.g. brave search
- Kimi K2.6 model set by default
You can use this repo in two ways:
- Start a new project — clone or fork this repository, delete README.md, build something new
- Add to an existing project — copy
Containerfileandjustfileinto your repo
Provider
This setup defaults to OpenRouter. You can edit the justfile to change providers.
Prerequisites
Quick start
1. Store your API keys
secret-tool store --label="OpenRouter API Key" type openrouter
secret-tool store --label="Brave API Key" type brave repo api # optional
2. Use Pi
just pi
3. Update Container
You can use a prompt like this to install dependencies for Pi (or really make any change to this setup):
You are running inside an Alpine linux based container. Edit Containerfile so that you have the necessary base image and dependencies to work on this codebase. Then request the user run `rebuild-pi` to apply the changes.
Commands
| Command | Description |
|---|---|
just pi |
Launch Pi (builds the image automatically if needed) |
just shell |
Open an interactive shell in the container |
just stop-pi |
Stop the persistent container |
just rebuild-pi |
Rebuild the image and reset the container after Containerfile changes |
justfiledoes not include abuildcommand by default. Add one (or ask Pi to add one) once the project's build system is known.