Skip to content

Commit 272cdf5

Browse files
committed
Add bin/check-image script to build and test the Docker image locally
1 parent 47156ad commit 272cdf5

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

bin/check-image

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env -S pkgx +podman bash>=4
2+
source <(pkgx dev --shellcode)
3+
set -euo pipefail
4+
5+
IMAGE_TAG="elixir_script:audit"
6+
7+
echo "Building Docker image..."
8+
podman build -f .github/Dockerfile -t "$IMAGE_TAG" .
9+
10+
echo "Testing Docker image..."
11+
# Test --help works
12+
OUTPUT=$(podman run --rm "$IMAGE_TAG" --help)
13+
if echo "$OUTPUT" | grep -q "Usage:"; then
14+
echo "✓ Docker image builds and runs successfully"
15+
else
16+
echo >&2 "✗ Docker image test failed"
17+
echo >&2 "$OUTPUT"
18+
exit 1
19+
fi
20+
21+
## Optional: test with a simple script
22+
#echo "Running smoke test..."
23+
#OUTPUT=$(podman run --rm -e INPUT_SCRIPT='IO.puts("Docker smoke test OK")' "$IMAGE_TAG" 2>&1)
24+
#if echo "$OUTPUT" | grep -q "Docker smoke test OK"; then
25+
# echo "✓ Smoke test passed"
26+
#else
27+
# echo >&2 "✗ Smoke test failed"
28+
# echo >&2 "$OUTPUT"
29+
# exit 1
30+
#fi

0 commit comments

Comments
 (0)