File size: 1,224 Bytes
b152fd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env bash
# Verify the Docker image builds successfully.
# Skips gracefully when docker/podman is not available.
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"

# Detect container runtime
if command -v docker >/dev/null 2>&1; then
  RUNTIME=docker
elif command -v podman >/dev/null 2>&1; then
  RUNTIME=podman
else
  echo "SKIP: neither docker nor podman found — skipping build test"
  exit 0
fi

# Verify the daemon is reachable (docker may be installed but not running)
if ! "$RUNTIME" info >/dev/null 2>&1; then
  echo "SKIP: $RUNTIME is installed but not running — skipping build test"
  exit 0
fi

IMAGE_TAG="paperclip-build-test:$$"
trap '"$RUNTIME" rmi "$IMAGE_TAG" >/dev/null 2>&1 || true' EXIT

echo "==> Testing Docker build with $RUNTIME"
"$RUNTIME" build \
  -f "$REPO_ROOT/Dockerfile" \
  -t "$IMAGE_TAG" \
  --target production \
  "$REPO_ROOT"

echo "==> Verifying key binaries in image"
"$RUNTIME" run --rm "$IMAGE_TAG" sh -c '
  set -e
  node --version
  git --version
  gh --version
  rg --version
  python3 --version
  curl --version | head -1
  claude --version 2>/dev/null || echo "claude CLI not found (OK in minimal builds)"
'

echo "PASS: Docker build test succeeded"