Files
PaperClipAI/scripts/docker-build-test.sh
T
Harold KimandPaperclip 98df214917 fix: fail closed on unusable Codex auth during sandbox auth merge
When reusing a Codex sandbox, the workspace-restore step now performs
an auth-merge check before adopting the sandbox's auth.json. The merge
fails closed when:

- host or sandbox Codex auth is unusable (missing token or account)
- the subscription payload shapes differ between host and sandbox
- subscription account identities do not match

Additional hardening: node absence on PATH during the embedded decision
script now exits non-zero instead of silently falling through. Co-change
comments link parseAuth (the embedded script) to hasUsableAuthPayload
(codex-home.ts) so a future auth-format change cannot silently diverge
between the two implementations.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-07-09 10:08:57 +00:00

47 lines
1.2 KiB
Bash
Executable File

#!/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"