Files
skillshare/scripts/_sandbox_common.sh
T
Willie 503ee8af24 refactor: DRY up Docker sandbox scripts with shared entrypoint and boilerplate
- Add docker/sandbox/entrypoint.sh to auto-copy /ui-dist → internal/server/dist/
  when missing, fixing the gitignore regression for all Docker workflows
- Add scripts/_sandbox_common.sh with shared SCRIPT_DIR, PROJECT_ROOT,
  COMPOSE_FILE, and require_docker() function
- Refactor all 5 sandbox scripts to source _sandbox_common.sh
- Use YAML extension fields (x-sandbox-common) in docker-compose.sandbox.yml
  to eliminate duplicated service config
- Break sandbox_playground_up.sh one-liner into readable steps, add
  skillshare-ui alias and init hint
- Change test.sh to use `make build` for placeholder consistency
2026-02-08 16:32:28 +08:00

19 lines
552 B
Bash

#!/usr/bin/env bash
# Shared boilerplate for Docker sandbox scripts.
# Source this file: source "$(dirname "$0")/_sandbox_common.sh"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
COMPOSE_FILE="$PROJECT_ROOT/docker-compose.sandbox.yml"
require_docker() {
if ! command -v docker >/dev/null 2>&1; then
echo "Error: docker command not found" >&2
exit 1
fi
if ! docker compose version >/dev/null 2>&1; then
echo "Error: docker compose plugin not available" >&2
exit 1
fi
}