File size: 870 Bytes
af2930e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
# Rebuild the cleanroom images locally instead of pulling them; then run setup.sh, which skips images already present.
# Usage: bash build/build.sh [REGEX]   (J=8 parallel builds)
set -euo pipefail
ROOT=$(cd "$(dirname "$0")" && pwd)
docker load -q -i "$ROOT/base.v6.tar.gz"
ls "$ROOT/contexts" | grep -E "${1:-.}" | xargs -P "${J:-8}" -I% bash -euc '
  iid=$(basename "$1" .tar.gz); d=$(mktemp -d -p "$0")
  trap "rm -rf $d" EXIT
  read -r gold_sha gold_blob < <(python3 "$0/verify_context.py" "$0/isolation_manifest.json" "$iid" "$0/contexts/$1" "$d")
  image="ghcr.io/programlab-agent/${iid//__/_1776_}:task_cleanroom_v6"
  docker build -q --network host -t "$image" "$d" >/dev/null
  docker run --rm --network none --user 1000:1000 -v "$0/probe.py:/probe.py:ro" "$image" python3 /probe.py "$gold_sha" "$gold_blob"
  echo "built $iid"
' "$ROOT" %