update docker.sh for porting to other projects, and add --name to nvfp4_quant

This commit is contained in:
zefie committed 2026-11-05 15:37:08 -05:00
1 parent 5265f78090
commit 164fa6b4a4
2 files changed
+10 -9

No files matched your search

+9 -8
View File
@@ -1,18 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail
DOCKER_IMAGE="zefie/nvfp4_quant"
CURDIR="$(realpath "$(dirname "${0}")")"
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 \
# Find all tags for ${DOCKER_IMAGE}, sort by creation timestamp (descending), return the newest
latest_image=$(docker images --format '{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}' ${DOCKER_IMAGE} \
| sort -r \
| cut -f2- \
| grep -v latest \
| head -n 1)
if [[ -z "$latest_image" ]]; then
echo "No images found for repository 'zefie/nvfp4_quant'" >&2
echo "No images found for repository '${DOCKER_IMAGE}'" >&2
exit 1
fi
@@ -22,14 +23,14 @@ get_latest() {
if [ "${1}" == "build" ]; then
THETAG=$(date +%Y%m%d)
cd "$(realpath "$(dirname "${0}")")"
docker buildx build --tag "zefie/nvfp4_quant:${THETAG}" .
docker buildx build --tag "${DOCKER_IMAGE}:${THETAG}" .
elif [ "${1}" == "mklatest" ]; then
LATEST=$(get_latest)
if [ -z "${LATEST}" ]; then
exit 1;
fi
docker tag "${LATEST}" zefie/nvfp4_quant:latest
echo "Set zefie/nvfp4_quant:latest to ${LATEST}"
docker tag "${LATEST}" ${DOCKER_IMAGE}:latest
echo "Set ${DOCKER_IMAGE}:latest to ${LATEST}"
elif [ "${1}" == "run" ]; then
shift
IMAGE=$(get_latest)
@@ -47,8 +48,8 @@ elif [ "${1}" == "push" ]; then
IMAGE=$(get_latest)
echo "Pushing ${IMAGE}"
docker push "${IMAGE}"
echo "Pushing zefie/nvfp4_quant:latest"
docker push "zefie/nvfp4_quant:latest"
echo "Pushing ${DOCKER_IMAGE}:latest"
docker push "${DOCKER_IMAGE}:latest"
else
echo "Usage: ${0} [build|run|mklatest]"
exit 1;
+1 -1
View File
@@ -3,7 +3,7 @@ TAG="${TAG:-latest}"
CMD="$(basename "${0}")"
IMAGE="${IMAGE:-zefie/nvfp4_quant:${TAG}}"
COMMON=(docker run --user 1000:1000 --rm --gpus all -it -v ./:/workspace "${IMAGE}")
COMMON=(docker run --name nvfp4_quant --user 1000:1000 --rm --gpus all -it -v ./:/workspace "${IMAGE}")
if [ -z "${EMBEDDED}" ]; then
if [ "${CMD}" == "nvfp4_quant" ]; then