Repository navigation
Expand file tree
/
Copy pathContainerfile
More file actions
191 lines (178 loc) · 10.2 KB
/
Copy pathContainerfile
File metadata and controls
191 lines (178 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# developer — a crunchtools development agent: Claude Code that can build
#
# Published as `developer`. The image is tooling; who runs in it is decided by
# the unit's mounts. Josui Prime runs it with Prime's identity and state, as
# the dispatcher on dolza. The workers (Vertex 1-4 on dolza, Max 1-4 on
# exedore) run it with the developer identity, their own Trentina profile and
# their own state, and none of them is given Prime's.
#
# It began as Containerfile.dev in crunchtools/josui, sharing that image's
# entrypoint and mount contract. It lives here now because the two are expected
# to diverge, and a repo named josui is the wrong home for an image that is not
# one (RT#1556). The mount contract is still josui's, deliberately: the units
# that run this image were written against it, and the JOSUI_* environment
# prefix is inherited for the same reason. Renaming that prefix is its own
# change, with a window where both are accepted — not a flag day bundled into
# a move.
#
# What it adds on top: a toolchain — python, uv, node, tmux — and a container
# engine, so an agent working in it can run a repo's real gates instead of
# waiting for CI to render them.
#
# WHY A DIFFERENT BASE, AND NOT `FROM josui`: a dev agent has to RUN
# containers, not only build them -- `sdlc` launches every check inside
# python-sdlc. On UBI 10 a nested `podman run` fails with "mount `proc` to
# `proc`: Operation not permitted", ruled out by measurement in
# crunchtools/gha-runner's Containerfile against crun versions, storage
# drivers, every userns/netns combination and --privileged. quay.io/podman/stable
# is the upstream project's own podman-in-podman image and does it correctly.
# The digest below is the one gha-runner already runs on gloval, so the two
# images share the host's layer cache.
#
# WHAT THIS COSTS, measured on gloval rather than assumed (2026-11-05,
# RT#1556). A container running this image needs, and needs no more than:
#
# --device /dev/fuse
# --cap-drop=all --cap-add=setuid,setgid,sys_chroot,chown,setfcap
# --security-opt label=disable
# the nested engine's storage on a volume (the root filesystem can stay
# --read-only, with tmpfs on /tmp, /var/tmp and /run)
#
# How that set was arrived at: --cap-drop=all alone fails with "newuidmap:
# operation not permitted"; adding setuid and setgid gets past newuidmap and
# then fails unpacking a layer ("after fallback to chroot"); sys_chroot is the
# one that fixes it; chown and setfcap are kept because a layer carrying
# either needs them. That is 5 of podman's 11 default capabilities -- no
# SYS_ADMIN, no DAC_OVERRIDE, no MKNOD, not privileged. With SELinux
# enforcing the nested PULL works and the nested RUN fails with "crun: read
# from sync socket: Connection reset by peer", which is what label=disable is
# for; it is set on these containers only, and every other container on the
# host keeps its confinement.
#
# Josui Prime runs this image too, and gets none of those flags: it
# dispatches rather than builds, so it never runs a nested engine, and it keeps
# its SELinux label. The flags belong to the unit, not to the image.
#
# Build happens in GitHub Actions (.github/workflows/container.yml).
FROM quay.io/podman/stable@sha256:0ccbc4e7f79f9c33e7fc959be59f714abbc0f4c9cffbe14f5bceff537a014738
LABEL maintainer="fatherlinux <scott.mccarty@crunchtools.com>"
LABEL version="1.16.0"
# The base sets this to its own release; the image reports ours.
LABEL org.opencontainers.image.version="1.16.0"
LABEL description="developer - a crunchtools development agent: Claude Code with a toolchain and nested podman"
# The same versions the production image runs. A new Claude Code or
# claude-agent is tested on Josui Prime before it reaches a dev container:
# bump both files together, by hand.
ARG CLAUDE_CODE_VERSION=2.1.304
ARG CLAUDE_AGENT_VERSION=1.2.0
# The Ashigaru CLI, whose `ashigaru hook` reports this seat to the Desk. 3.x
# is a Python package shipped as an RPM on each GitHub release, built on
# fedora:43 and centos:stream10; the fc43 build is noarch against Python 3.14,
# which is this base's too. A bump is these two lines: the version and the
# sha256 of that release's fc43 RPM. Only one RPM is installed (noarch, one
# dist), so one hash covers it.
ARG ASHIGARU_VERSION=3.3.0
ARG ASHIGARU_SHA256=23840a7d32f50071021fcc187d38997bd1ddcccded0716a34a930113630f3379
USER 0
# Anthropic's signed repository for claude-code and crunchtools' for
# claude-agent, keys imported up front (constitution XIV: repository
# definitions and keys may live in an image). The crunchtools repo sets
# repo_gpgcheck=1, so dnf needs the key in its own keyring too -- hence -y on
# every dnf below, which answers the key prompt rather than hanging on it.
RUN rpm --import https://downloads.claude.ai/keys/claude-code.asc && \
rpm --import https://crunchtools.github.io/packages/crunchtools.asc && \
printf '%s\n' '[claude-code]' 'name=Claude Code' \
'baseurl=https://downloads.claude.ai/claude-code/rpm/stable' \
'enabled=1' 'gpgcheck=1' 'gpgkey=https://downloads.claude.ai/keys/claude-code.asc' \
> /etc/yum.repos.d/claude-code.repo && \
curl -fsSL -o /etc/yum.repos.d/crunchtools.repo \
https://crunchtools.github.io/packages/rpm/crunchtools.repo
# Fedora 44's python3 IS 3.14, which is what Trentina's requires-python asks
# for, so nothing here fetches a Python runtime at run time. uv and pre-commit
# come from the distribution for the same reason: a dev container's network is
# an allowlist, and every tool it has to download is another host on it.
#
# tmux is how a person reaches the live session (README, "Attaching").
# nodejs-full-i18n: without the locale data, tests that format a date pass in
# a site's own container and fail here.
# `upgrade` before `install`, and it is load-bearing rather than tidiness:
# Trivy cannot scan Fedora packages ("Unsupported os family"), and the base is
# pinned by digest, so this line is the ONLY thing in the pipeline that moves
# the OS layer forward. It runs on every weekly `parent-image-updated` rebuild.
RUN dnf -y upgrade && \
dnf -y install --setopt=install_weak_deps=0 \
git-core git openssh-clients jq tar gzip findutils diffutils which \
procps-ng hostname rsync less sqlite ripgrep tmux \
python3 python3-devel python3-pip gcc make \
uv pre-commit \
nodejs nodejs-full-i18n npm \
"claude-code-${CLAUDE_CODE_VERSION}" \
"claude-agent-${CLAUDE_AGENT_VERSION}" "claude-agent-matrix-${CLAUDE_AGENT_VERSION}" \
"claude-agent-trentina-${CLAUDE_AGENT_VERSION}" && \
dnf -y clean all && \
rm -rf /var/cache/dnf && \
claude --version && claude-agent --version && \
python3 -c 'import sys; assert sys.version_info[:2] >= (3, 14), sys.version' && \
uv --version && tmux -V && podman --version
# Straight from the release, not from a dnf repository: the crunchtools repo
# does not carry ashigaru, and a release that has no RPM attached fails the
# build here rather than shipping a seat without the CLI. The RPM is unsigned
# and rpm.yml uploads with --clobber, so the asset at that URL can be replaced:
# the pinned hash, not TLS, is what says this is the file that was reviewed.
#
# The RPM ships the /ashigaru skill under /usr/share/ashigaru/skills. HOME is
# a volume, so ~/.claude/skills cannot carry it: it is linked into Claude
# Code's managed skills folder, /etc/claude-code/.claude/skills, which every
# session loads beside the josui-skills links in ~/.claude/skills. A link, not
# a copy, so a version bump brings its own skill with it.
RUN rpm=/tmp/ashigaru-${ASHIGARU_VERSION}-1.fc43.noarch.rpm && \
curl -fsSL -o "$rpm" \
"https://github.com/crunchtools/ashigaru/releases/download/v${ASHIGARU_VERSION}/${rpm##*/}" && \
echo "${ASHIGARU_SHA256} $rpm" | sha256sum -c --strict - && \
dnf -y install --setopt=install_weak_deps=0 "$rpm" && \
rm -f "$rpm" && \
dnf -y clean all && \
rm -rf /var/cache/dnf && \
mkdir -p /etc/claude-code/.claude/skills && \
ln -s /usr/share/ashigaru/skills/ashigaru /etc/claude-code/.claude/skills/ashigaru && \
test -f /etc/claude-code/.claude/skills/ashigaru/SKILL.md && \
test "$(rpm -q --qf '%{VERSION}' ashigaru)" = "$ASHIGARU_VERSION" && \
ashigaru --help > /dev/null
# uid 1000 is the base's own `podman` user, with the subuid ranges that make
# nesting work. It is NOT renamed to josui: that layout is the reason this
# base was chosen, and HOME follows it instead.
RUN mkdir -p /etc/josui /var/lib/josui/josui-skills /var/log/josui && \
chown 1000:1000 /var/lib/josui /var/lib/josui/josui-skills /var/log/josui
COPY rootfs/ /
RUN chmod 0755 /usr/local/bin/developer-entrypoint /usr/local/bin/developer-worker-claude \
/usr/local/bin/developer-skills-sync \
/usr/libexec/developer/seat-state /usr/libexec/developer/ashigaru-hook && \
bash -n /usr/local/bin/developer-entrypoint
# HOME is a volume: the Claude login, sessions, git identity and the agent's
# clones live there and survive a restart. The nested engine's storage is a
# volume of its own mounted over .local/share/containers -- it is a cache, and
# it does not belong in the state backup.
# LANG: a tmux client started by `podman exec ... tmux attach` has no locale
# otherwise, and tmux then draws every non-ASCII character as "_".
# PYTEST_XDIST_AUTO_NUM_WORKERS: `-n auto` (trentina's addopts) otherwise
# starts one ~280 MB worker per host core -- 24 here -- which is past the
# seat's memcg, and the OOM killer takes the Claude session with the tests.
# ASHIGARU_URL is where the Desk is, which is config: the image says it once
# rather than every unit. The key is not, and comes only from the unit
# (ASHIGARU_API_KEY_FILE); without one `ashigaru` stops with "no API key" and
# ashigaru-hook stays silent, as before.
ENV HOME=/home/podman \
ASHIGARU_URL=https://ashigaru.crunchtools.com \
LANG=C.UTF-8 \
PYTEST_XDIST_AUTO_NUM_WORKERS=4 \
JOSUI_CONFIG_DIR=/etc/josui \
JOSUI_SKILLS_DIR=/var/lib/josui/josui-skills \
CLAUDE_AGENT=1 \
CLAUDE_AGENT_AUDIT_DIR=/var/log/josui \
CLAUDE_AGENT_BREAKER_DIR=/tmp/josui-breaker \
DISABLE_AUTOUPDATER=1 \
DISABLE_ERROR_REPORTING=1 \
DISABLE_TELEMETRY=1
USER 1000
WORKDIR /home/podman
ENTRYPOINT ["/usr/local/bin/developer-entrypoint"]