Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# libwallaby devcontainer

A Debian 13 environment that builds libwallaby for the Wombat (`aarch64`) and for the desktop (`-DDUMMY=ON`), with the Claude Code and Codex CLIs installed.

## What's in the image

The image is the `dev` stage of the repo's root [`Dockerfile`](../Dockerfile):

- **`toolchain` stage** (shared with the release builder): the `aarch64` cross-compiler, CMake, SWIG, Doxygen, and the `arm64` X11 and Python 3.13 libraries the Wombat build links against.
- **`dev` stage** adds:
- the native X11 and Python 3.13 libraries for the desktop build
- dev tools: fish, git, ripgrep, fd, fzf, jq, curl, ssh
- the Claude Code and Codex CLIs (Codex needs Node, so `nodejs`/`npm` are installed too)
- bubblewrap for the agents' sandbox

The user is `code` (UID 1000, home `/home/code`, shell fish).

The `builder` stage, which `docker build .` builds by default, is the release builder from the main README. Its toolchain comes from the same `toolchain` stage, so a toolchain change applies to both.

## Opening it

- VS Code: run **Dev Containers: Reopen in Container**.
- CLI: `devcontainer up --workspace-folder .`, then `devcontainer exec --workspace-folder . fish`.

To build the image without the devcontainer tooling:

```sh
docker build --target dev -t libwallaby-dev .
```

Rebuild the container after changing the `Dockerfile` or `devcontainer.json`.

## Building libwallaby inside it

Wombat (`aarch64`), which also produces `build/kipr-<version>-Linux.deb`:

```sh
cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE=toolchain/aarch64-linux-gnu.cmake .
cmake --build build -j "$(nproc)"
```

Desktop (dummy backend):

```sh
cmake -Bbuild-desktop -DDUMMY=ON -Dpackage_debian=OFF -Dwith_camera=OFF .
cmake --build build-desktop -j "$(nproc)"
```

The camera module downloads its dependencies, so the Wombat build needs internet access.
The Simulator (Emscripten) build is not set up here. It needs the emsdk, which is not in the image.

## Agent CLIs

Claude Code and Codex keep their logins and settings in Docker named volumes, `claude-config` and `codex-config`.
Every devcontainer that uses these volume names shares them, so you log in once per machine.
The volumes survive container rebuilds. Remove them with `docker volume rm claude-config codex-config`.

First-time login and smoke test:

```sh
claude # follow the login prompt, then /exit
claude -p "say hi"
codex login
codex exec "say hi"
codex sandbox -- true # checks the bubblewrap sandbox
```

Containers share the volumes live, so agent sessions running in two containers at once write to the same files.

Host-level agent config (user settings, skills, plugins, memories) is not shared with the container. Project-level config (`.claude/`, `AGENTS.md`) comes with the workspace.

## Caveats

- **seccomp and path masking are disabled.** The agents' bubblewrap sandbox fails under Docker's default seccomp profile and can't mount `/proc` while Docker masks paths under it. The container therefore runs with `--security-opt=seccomp=unconfined` and `--security-opt=systempaths=unconfined`, which turn off Docker's syscall filter and its `/proc`/`/sys` masking for the container.
- **SELinux hosts.** If the workspace mount is denied (for example under Podman), add `"--security-opt=label=disable"` to `runArgs`.
- **No hardware access.** The container can't reach a Wombat over USB. Copy the `.deb` to the Wombat over the network as the main README describes.
35 changes: 35 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "libwallaby Dev",
"build": {
"dockerfile": "../Dockerfile",
"context": "..",
"target": "dev"
},
"mounts": [
"source=claude-config,target=/home/code/.claude,type=volume",
"source=codex-config,target=/home/code/.codex,type=volume"
],
// For the agent CLIs' bubblewrap sandbox: seccomp=unconfined because it
// fails under Docker's default seccomp profile, systempaths=unconfined
// because it can't mount /proc while Docker masks paths under it.
"runArgs": [
"--security-opt=seccomp=unconfined",
"--security-opt=systempaths=unconfined"
],
"remoteUser": "code",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"github.vscode-pull-request-github",
"openai.chatgpt"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "fish",
"terminal.integrated.profiles.linux": {
"fish": { "path": "/usr/bin/fish" }
}
}
}
}
}
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.13)

project(libkipr)

option(package_debian "Build a Debian package" OFF)
option(package_debian "Build a Debian package" ON)

set(KIPR_VERSION_MAJOR 1)
set(KIPR_VERSION_MINOR 2)
Expand Down Expand Up @@ -120,4 +120,17 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${KIPR_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${KIPR_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${KIPR_VERSION_PATCH})
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libgcc-s1, libstdc++6, libx11-6, zlib1g, libpython3.13")
include(CPack)

if(package_debian AND NOT EMSCRIPTEN)
if(TARGET kipr_python)
add_dependencies(kipr kipr_python)
endif()
add_custom_command(TARGET kipr POST_BUILD
COMMAND ${CMAKE_CPACK_COMMAND}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Generating Debian package with CPack"
VERBATIM
)
endif()
78 changes: 78 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Debian 13 (trixie) is the documented build platform: it ships the arm64
# libpython3.13 that the Wombat package depends on (see CMakeLists.txt).
FROM debian:13.6 AS toolchain

# Cross-compiler plus the arm64 libraries the default Wombat build links.
# libpython3.13-dev:arm64 rather than python3.13-dev:arm64: the latter pulls
# in the arm64 interpreter, which displaces the native python3 (see README).
RUN dpkg --add-architecture arm64 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
binutils \
build-essential \
ca-certificates \
cmake \
doxygen \
file \
g++-aarch64-linux-gnu \
gcc \
gcc-aarch64-linux-gnu \
git \
libpython3.13-dev:arm64 \
libx11-dev:arm64 \
make \
swig \
wget \
&& rm -rf /var/lib/apt/lists/*


# Development container (.devcontainer/devcontainer.json selects this target).
FROM toolchain AS dev

# Dev tools, plus:
# - libpython3.13-dev, libx11-dev: native libraries for the desktop
# (-DDUMMY=ON) build, alongside the arm64 ones above
# - nodejs, npm: to install the Codex CLI
# - bubblewrap: the agent CLIs' sandbox
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bubblewrap \
curl \
fd-find \
fish \
fzf \
jq \
libpython3.13-dev \
libx11-dev \
nodejs \
npm \
openssh-client \
ripgrep \
&& ln -s "$(command -v fdfind)" /usr/local/bin/fd \
&& rm -rf /var/lib/apt/lists/*

RUN groupadd --gid 1000 code \
&& useradd --uid 1000 --gid 1000 --create-home --shell /usr/bin/fish code

USER code
# Agent state lives in named volumes; a new volume inherits this ownership.
# CLAUDE_CONFIG_DIR also moves ~/.claude.json inside the volume.
# NPM_CONFIG_PREFIX puts global npm installs (Codex) in ~/.local/bin.
ENV CLAUDE_CONFIG_DIR=/home/code/.claude \
CODEX_HOME=/home/code/.codex \
NPM_CONFIG_PREFIX=/home/code/.local \
PATH=/home/code/.local/bin:$PATH
RUN mkdir -p "$CLAUDE_CONFIG_DIR" "$CODEX_HOME" \
&& curl -fsSL https://claude.ai/install.sh | bash \
&& claude --version \
&& npm install -g @openai/codex \
&& codex --version


# Release builder (README "Wombat"). Kept last so `docker build .` builds it.
FROM toolchain AS builder

RUN groupadd --gid 1000 kipr \
&& useradd --uid 1000 --gid 1000 kipr

USER kipr:kipr
Loading
Loading