From 782c341b206fb729103ab7d4a5306a76b84d7b83 Mon Sep 17 00:00:00 2001 From: DanielTemesgen <40549299+DanielTemesgen@users.noreply.github.com> Date: Sat, 25 May 2024 15:09:24 +0100 Subject: [PATCH] Update build_image.sh to build image using buildx and use both arm and amd platforms, this command also pushes the image, it can not be loaded into the local registry due to limitations in buildx Also update build_upload_release.py and docker_nightly.py so docker images do not need to be pushed separately --- kubernetes/kserve/build_image.sh | 3 ++- kubernetes/kserve/build_upload_release.py | 6 ------ kubernetes/kserve/docker_nightly.py | 16 +++++----------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/kubernetes/kserve/build_image.sh b/kubernetes/kserve/build_image.sh index b644dc37f7..b3215a8923 100755 --- a/kubernetes/kserve/build_image.sh +++ b/kubernetes/kserve/build_image.sh @@ -57,4 +57,5 @@ fi cp ../../frontend/server/src/main/resources/proto/*.proto . cp -r ../../third_party . -DOCKER_BUILDKIT=1 docker build --file "$DOCKER_FILE" --build-arg BASE_IMAGE=$BASE_IMAGE -t "$DOCKER_TAG" . +docker buildx create --name mybuilder --use --bootstrap +docker buildx build --file "$DOCKER_FILE" --build-arg BASE_IMAGE=$BASE_IMAGE --platform linux/amd64,linux/arm64 --push -t "$DOCKER_TAG" . diff --git a/kubernetes/kserve/build_upload_release.py b/kubernetes/kserve/build_upload_release.py index 55183c7a03..4dc0cc83ec 100644 --- a/kubernetes/kserve/build_upload_release.py +++ b/kubernetes/kserve/build_upload_release.py @@ -39,12 +39,6 @@ dry_run, ) - for image in [ - f"{organization}/torchserve-kfs:{check_ts_version()}", - f"{organization}/torchserve-kfs:{check_ts_version()}-gpu", - ]: - try_and_handle(f"docker push {image}", dry_run) - # Cleanup built images if args.cleanup: try_and_handle(f"docker system prune --all --volumes -f", dry_run) diff --git a/kubernetes/kserve/docker_nightly.py b/kubernetes/kserve/docker_nightly.py index 209c0d976e..cd2181b1de 100644 --- a/kubernetes/kserve/docker_nightly.py +++ b/kubernetes/kserve/docker_nightly.py @@ -36,18 +36,16 @@ cpu_version = f"{project}:cpu-{get_nightly_version()}" gpu_version = f"{project}:gpu-{get_nightly_version()}" - # Build Nightly images and append the date in the name - try_and_handle(f"./build_image.sh -n -t {organization}/{cpu_version}", dry_run) + # Build and push Nightly images and append the date in the name + try_and_handle( + f"./build_image.sh -n -t {organization}/{cpu_version}", + dry_run) try_and_handle( f"./build_image.sh -g -n -t {organization}/{gpu_version}", dry_run, ) - # Push Nightly images to official PyTorch Dockerhub account - try_and_handle(f"docker push {organization}/{cpu_version}", dry_run) - try_and_handle(f"docker push {organization}/{gpu_version}", dry_run) - - # Tag nightly images with latest + # Build and push Nightly images with latest try_and_handle( f"docker tag {organization}/{cpu_version} {organization}/{project}:latest-cpu", dry_run, @@ -57,10 +55,6 @@ dry_run, ) - # Push images with latest tag - try_and_handle(f"docker push {organization}/{project}:latest-cpu", dry_run) - try_and_handle(f"docker push {organization}/{project}:latest-gpu", dry_run) - # Cleanup built images if args.cleanup: try_and_handle(f"docker system prune --all --volumes -f", dry_run)