45 lines
1021 B
Bash
Executable File
45 lines
1021 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
get_latest() {
|
|
# Find all tags for zefie/nvfp4_quant, sort by creation timestamp (descending), return the newest
|
|
latest_image=$(docker images --format '{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}' zefie/nvfp4_quant \
|
|
| sort -r \
|
|
| cut -f2- \
|
|
| head -n 1)
|
|
|
|
if [[ -z "$latest_image" ]]; then
|
|
echo "No images found for repository 'zefie/nvfp4_quant'" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "$latest_image"
|
|
}
|
|
|
|
if [ "${1}" == "build" ]; then
|
|
THETAG=$(date +%Y%m%d)
|
|
cd "$(realpath "$(dirname "${0}")")"
|
|
docker buildx build --tag zefie/nvfp4_quant:${THETAG} .
|
|
elif [ "${1}" == "mklatest" ]; then
|
|
LATEST=$(get_latest)
|
|
if [ -z "${LATEST}" ]; then
|
|
exit 1;
|
|
fi
|
|
docker tag ${LATEST} zefie/nvfp4_quant:latest
|
|
elif [ "${1}" == "run" ]; then
|
|
shift
|
|
IMAGE=$(get_latest)
|
|
if [ -z "${IMAGE}" ]; then
|
|
exit 1;
|
|
fi
|
|
export EMBEDDED=1
|
|
source ${HOME}/bin/nvfp4_quant
|
|
CMD=("${COMMON[@]}" "${@}")
|
|
echo "Executing ${CMD[@]}"
|
|
"${CMD[@]}"
|
|
else
|
|
echo "Usage: ${0} [build|run|mklatest]"
|
|
exit 1;
|
|
fi
|
|
|