| 1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env bash
- # Build the SM121 DeepSeek-V4-Flash-Vision-Exp image. The generic driver
- # forwards every KEY=VAL pin in versions.env as a --build-arg to the
- # Dockerfile; TAG and BASE_IMAGE can be overridden via the environment for
- # the fork comparison (TAG=dsv4-flash-vision-eugr:local and
- # TAG=dsv4-flash-vision-aiden:local from the same context).
- set -euo pipefail
- cd "$(dirname "$0")"
- TAG="${TAG:-dsv4-flash-vision:local}"
- ARGS=()
- while IFS= read -r line; do
- case "$line" in
- ''|\#*) continue ;;
- esac
- key="${line%%=*}"; val="${line#*=}"
- val="${val%\"}"; val="${val#\"}"
- [ -n "$key" ] && ARGS+=(--build-arg "${key}=${val}")
- done < versions.env
- [ -n "${BASE_IMAGE:-}" ] && ARGS+=(--build-arg "BASE_IMAGE=${BASE_IMAGE}")
- echo "=== Building ${TAG} ==="
- # Persistent buildkit cache (per node, shared across image dirs): the
- # version-independent stages (apt, torch, CUDA base) are reused across
- # rebuilds — only the pinned source stages (vllm/b12x/…) re-download and
- # re-compile. Override the dir with SM121_BUILDKIT_CACHE if desired.
- CACHE_DIR="${SM121_BUILDKIT_CACHE:-$HOME/.cache/sm121-buildkit}"
- mkdir -p "${CACHE_DIR}"
- docker buildx build "${ARGS[@]}" --cache-from "type=local,src=${CACHE_DIR}" \
- --cache-to "type=local,dest=${CACHE_DIR},mode=max" \
- --progress=plain --load -t "${TAG}" -f Dockerfile . 2>&1
- echo "=== Done: ${TAG} ==="
|