update docker.sh for porting to other projects, and add --name to nvfp4_quant
This commit is contained in:
1 parent
5265f78090
commit
164fa6b4a4
2 files changed
+10
-9
No files matched your search
@@ -1,18 +1,19 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
DOCKER_IMAGE="zefie/nvfp4_quant"
|
||||||
CURDIR="$(realpath "$(dirname "${0}")")"
|
CURDIR="$(realpath "$(dirname "${0}")")"
|
||||||
|
|
||||||
get_latest() {
|
get_latest() {
|
||||||
# Find all tags for zefie/nvfp4_quant, sort by creation timestamp (descending), return the newest
|
# Find all tags for ${DOCKER_IMAGE}, sort by creation timestamp (descending), return the newest
|
||||||
latest_image=$(docker images --format '{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}' zefie/nvfp4_quant \
|
latest_image=$(docker images --format '{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}' ${DOCKER_IMAGE} \
|
||||||
| sort -r \
|
| sort -r \
|
||||||
| cut -f2- \
|
| cut -f2- \
|
||||||
| grep -v latest \
|
| grep -v latest \
|
||||||
| head -n 1)
|
| head -n 1)
|
||||||
|
|
||||||
if [[ -z "$latest_image" ]]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -22,14 +23,14 @@ get_latest() {
|
|||||||
if [ "${1}" == "build" ]; then
|
if [ "${1}" == "build" ]; then
|
||||||
THETAG=$(date +%Y%m%d)
|
THETAG=$(date +%Y%m%d)
|
||||||
cd "$(realpath "$(dirname "${0}")")"
|
cd "$(realpath "$(dirname "${0}")")"
|
||||||
docker buildx build --tag "zefie/nvfp4_quant:${THETAG}" .
|
docker buildx build --tag "${DOCKER_IMAGE}:${THETAG}" .
|
||||||
elif [ "${1}" == "mklatest" ]; then
|
elif [ "${1}" == "mklatest" ]; then
|
||||||
LATEST=$(get_latest)
|
LATEST=$(get_latest)
|
||||||
if [ -z "${LATEST}" ]; then
|
if [ -z "${LATEST}" ]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
docker tag "${LATEST}" zefie/nvfp4_quant:latest
|
docker tag "${LATEST}" ${DOCKER_IMAGE}:latest
|
||||||
echo "Set zefie/nvfp4_quant:latest to ${LATEST}"
|
echo "Set ${DOCKER_IMAGE}:latest to ${LATEST}"
|
||||||
elif [ "${1}" == "run" ]; then
|
elif [ "${1}" == "run" ]; then
|
||||||
shift
|
shift
|
||||||
IMAGE=$(get_latest)
|
IMAGE=$(get_latest)
|
||||||
@@ -47,8 +48,8 @@ elif [ "${1}" == "push" ]; then
|
|||||||
IMAGE=$(get_latest)
|
IMAGE=$(get_latest)
|
||||||
echo "Pushing ${IMAGE}"
|
echo "Pushing ${IMAGE}"
|
||||||
docker push "${IMAGE}"
|
docker push "${IMAGE}"
|
||||||
echo "Pushing zefie/nvfp4_quant:latest"
|
echo "Pushing ${DOCKER_IMAGE}:latest"
|
||||||
docker push "zefie/nvfp4_quant:latest"
|
docker push "${DOCKER_IMAGE}:latest"
|
||||||
else
|
else
|
||||||
echo "Usage: ${0} [build|run|mklatest]"
|
echo "Usage: ${0} [build|run|mklatest]"
|
||||||
exit 1;
|
exit 1;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ TAG="${TAG:-latest}"
|
|||||||
CMD="$(basename "${0}")"
|
CMD="$(basename "${0}")"
|
||||||
|
|
||||||
IMAGE="${IMAGE:-zefie/nvfp4_quant:${TAG}}"
|
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 [ -z "${EMBEDDED}" ]; then
|
||||||
if [ "${CMD}" == "nvfp4_quant" ]; then
|
if [ "${CMD}" == "nvfp4_quant" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user