anvilsign in

collin/anvil

1#!/usr/bin/env bash
2# Build the shared anvil runner image(s) — what BOTH CI jobs and agent sessions
3# execute in.
4#
5# Two tags from one Dockerfile, differing only in base:
6#
7# anvil-runner:latest ubuntu:26.04 general purpose, the default
8# anvil-runner:rust rust:1.95-bookworm carries the Rust toolchain
9#
10# There is deliberately no registry push: anvil resolves its default image from
11# the LOCAL image store and treats a failed pull as non-fatal when the image is
12# already present. So this must run on whichever host owns the Docker daemon
13# anvil talks to — the VPS in production, your machine in dev.
14#
15# ./deploy/runner/build.sh # both tags
16# ./deploy/runner/build.sh latest # just the slim one
17# ./deploy/runner/build.sh rust # just the toolchain one
18set -euo pipefail
19
20cd "$(dirname "$0")"
21
22NAME="${ANVIL_RUNNER_IMAGE:-anvil-runner}"
23CHANNEL="${CLAUDE_CHANNEL:-stable}"
24
25build() {
26 local tag="$1" base="$2"
27 echo "==> building ${NAME}:${tag} (base ${base}, claude channel ${CHANNEL})"
28 docker build \
29 --build-arg "BASE=${base}" \
30 --build-arg "CLAUDE_CHANNEL=${CHANNEL}" \
31 -t "${NAME}:${tag}" \
32 .
33}
34
35case "${1:-all}" in
36 latest) build latest ubuntu:26.04 ;;
37 rust) build rust rust:1.95-bookworm ;;
38 all)
39 build latest ubuntu:26.04
40 build rust rust:1.95-bookworm
41 ;;
42 *)
43 echo "usage: $0 [latest|rust|all]" >&2
44 exit 64
45 ;;
46esac
47
48echo
49echo "==> done"
50docker images "${NAME}" --format ' {{.Repository}}:{{.Tag}} {{.Size}}'
51echo
52echo "Point anvil at it in anvil.toml if you use a non-default name:"
53echo " [ci]"
54echo " default_image = \"${NAME}:latest\""
55echo " [agent]"
56echo " image = \"${NAME}:latest\""