Spaces:
Sleeping
Sleeping
Download scripts/docker_smoke.sh from joemartis/AccessibilityToolkit: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/spaces/joemartis/AccessibilityToolkit/resolve/main/scripts/docker_smoke.sh
- Command line
-
hf download hf://spaces/joemartis/AccessibilityToolkit/scripts/docker_smoke.sh
-
curl -L -o docker_smoke.sh https://huggingface.co/spaces/joemartis/AccessibilityToolkit/resolve/main/scripts/docker_smoke.sh
1.08 kB
| # Build the Docker image, run the container, wait for it to come up, run the | |
| # HTTP smoke test against it, then tear everything down. | |
| # | |
| # Usage: scripts/docker_smoke.sh | |
| # Requires a running Docker daemon. | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| IMAGE="ppt-pdf-tools:smoke" | |
| NAME="ppt-pdf-tools-smoke" | |
| PORT="${PORT:-8123}" | |
| BASE_URL="http://localhost:$PORT" | |
| cleanup() { | |
| docker rm -f "$NAME" >/dev/null 2>&1 || true | |
| } | |
| trap cleanup EXIT | |
| echo "==> Building image ($IMAGE)…" | |
| docker build -t "$IMAGE" "$ROOT" | |
| echo "==> Starting container on port $PORT…" | |
| cleanup | |
| docker run -d --name "$NAME" -p "$PORT:8000" "$IMAGE" >/dev/null | |
| echo "==> Waiting for health…" | |
| for i in $(seq 1 30); do | |
| if curl -fs "$BASE_URL/api/health" >/dev/null 2>&1; then | |
| echo " up after ${i}s" | |
| break | |
| fi | |
| if [ "$i" -eq 30 ]; then | |
| echo " container failed to become healthy; logs:" | |
| docker logs "$NAME" || true | |
| exit 1 | |
| fi | |
| sleep 1 | |
| done | |
| echo "==> Running HTTP smoke test…" | |
| "$ROOT/scripts/smoke_test.sh" "$BASE_URL" | |