build.sh 930 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # Build the Mistral Large 4 NVFP4 SGLang image for DGX Spark (aarch64).
  3. #
  4. # Generic driver: forwards every KEY=VAL pin in versions.env as a
  5. # --build-arg to the Dockerfile (no hardcoded variable list). The sm121
  6. # launcher writes a merged versions.env here when a recipe carries
  7. # [build.versions] overrides (recipe wins over the image defaults).
  8. set -euo pipefail
  9. cd "$(dirname "$0")"
  10. TAG="${TAG:-mistral-large4-sglang:local}"
  11. ARGS=()
  12. while IFS= read -r line; do
  13. # Skip blank lines and comments (# ...).
  14. case "$line" in
  15. ''|\#*) continue ;;
  16. esac
  17. key="${line%%=*}"
  18. val="${line#*=}"
  19. [ -n "$key" ] && ARGS+=(--build-arg "${key}=${val}")
  20. done < versions.env
  21. echo "=== Building ${TAG} ==="
  22. # No buildkit cache mount needed: a single FROM stage, no compile.
  23. docker buildx build "${ARGS[@]}" \
  24. --progress=plain --load -t "${TAG}" -f Dockerfile . 2>&1
  25. echo "=== Done: ${TAG} ==="