From 3750090df314cf7cb5bd14d4d78560517bd62e46 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Wed, 5 Mar 2025 15:27:36 -0800 Subject: [PATCH 1/9] Add runtime image for final container build --- build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index e35e910d98..6dcfe9f31b 100755 --- a/build.py +++ b/build.py @@ -1744,6 +1744,11 @@ def create_build_dockerfiles( FLAGS.build_dir, "Dockerfile.buildbase", dockerfileargmap ) + #Update dockerfileargmap if rt_base image is provided + if "rt_base" in images: + dockerfileargmap["BASE_IMAGE"] = images["rt_base"] + + if target_platform() == "windows": create_dockerfile_windows( FLAGS.build_dir, @@ -2940,7 +2945,7 @@ def enable_all(): ) fail_if( parts[0] - not in ["base", "gpu-base", "pytorch", "tensorflow", "tensorflow2"], + not in ["base", "gpu-base", "pytorch", "tensorflow", "tensorflow2","build_base","rt_base"], "unsupported value for --image", ) log('image "{}": "{}"'.format(parts[0], parts[1])) From 571a6d72b567125c237e8efa3282b3cda4c89b00 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Wed, 5 Mar 2025 15:31:37 -0800 Subject: [PATCH 2/9] Remove build_base parameter --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index 6dcfe9f31b..2eebc11511 100755 --- a/build.py +++ b/build.py @@ -2945,7 +2945,7 @@ def enable_all(): ) fail_if( parts[0] - not in ["base", "gpu-base", "pytorch", "tensorflow", "tensorflow2","build_base","rt_base"], + not in ["base", "gpu-base", "pytorch", "tensorflow", "tensorflow2","rt_base"], "unsupported value for --image", ) log('image "{}": "{}"'.format(parts[0], parts[1])) From d145aea20c6259d9765d35a973627f45bde49edc Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Sun, 9 Mar 2025 21:33:53 -0700 Subject: [PATCH 3/9] Set rt_base image as local variable for create_dockerfile_* function --- build.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/build.py b/build.py index 2eebc11511..6691d543dd 100755 --- a/build.py +++ b/build.py @@ -1220,8 +1220,13 @@ def create_dockerfile_cibase(ddir, dockerfile_name, argmap): def create_dockerfile_linux( - ddir, dockerfile_name, argmap, backends, repoagents, caches, endpoints + ddir, dockerfile_name, argmap, backends, repoagents, caches, endpoints, rt_base_image=None ): + base_image = argmap["BASE_IMAGE"] + #If runtime base image is provided, use it as the base image + if rt_base_image: + base_image = rt_base_image + df = """ ARG TRITON_VERSION={} ARG TRITON_CONTAINER_VERSION={} @@ -1230,7 +1235,7 @@ def create_dockerfile_linux( """.format( argmap["TRITON_VERSION"], argmap["TRITON_CONTAINER_VERSION"], - argmap["BASE_IMAGE"], + base_image, ) # PyTorch and TensorFlow backends need extra CUDA and other @@ -1642,8 +1647,13 @@ def change_default_python_version_rhel(version): def create_dockerfile_windows( - ddir, dockerfile_name, argmap, backends, repoagents, caches + ddir, dockerfile_name, argmap, backends, repoagents, caches, rt_base_image=None ): + base_image = argmap["BASE_IMAGE"] + #If runtime base image is provided, use it as the base image + if rt_base_image: + base_image = rt_base_image + df = """ ARG TRITON_VERSION={} ARG TRITON_CONTAINER_VERSION={} @@ -1666,7 +1676,7 @@ def create_dockerfile_windows( """.format( argmap["TRITON_VERSION"], argmap["TRITON_CONTAINER_VERSION"], - argmap["BASE_IMAGE"], + base_image, ) df += """ WORKDIR /opt @@ -1744,9 +1754,6 @@ def create_build_dockerfiles( FLAGS.build_dir, "Dockerfile.buildbase", dockerfileargmap ) - #Update dockerfileargmap if rt_base image is provided - if "rt_base" in images: - dockerfileargmap["BASE_IMAGE"] = images["rt_base"] if target_platform() == "windows": @@ -1757,6 +1764,7 @@ def create_build_dockerfiles( backends, repoagents, caches, + images.get("rt_base"), ) else: create_dockerfile_linux( @@ -1767,6 +1775,7 @@ def create_build_dockerfiles( repoagents, caches, endpoints, + images.get("rt_base") ) # Dockerfile used for the creating the CI base image. From a48c900292f6b371487211d1994d7ba83e3f352b Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Tue, 11 Mar 2025 15:18:30 -0700 Subject: [PATCH 4/9] Add git as a dependency for QA images --- Dockerfile.QA | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.QA b/Dockerfile.QA index 2205e0c116..c9e03c40a2 100644 --- a/Dockerfile.QA +++ b/Dockerfile.QA @@ -55,6 +55,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ + git \ libarchive-dev \ libboost-dev \ python3-dev \ From d6e151b61508b1db4e5b887031d4c81bc5985ea0 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Tue, 11 Mar 2025 16:23:55 -0700 Subject: [PATCH 5/9] Revert "Add git as a dependency for QA images" This reverts commit e0a5d2f6f73e5dd8bbb3956ec32abd173b7e9f1f. --- Dockerfile.QA | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.QA b/Dockerfile.QA index c9e03c40a2..2205e0c116 100644 --- a/Dockerfile.QA +++ b/Dockerfile.QA @@ -55,7 +55,6 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ - git \ libarchive-dev \ libboost-dev \ python3-dev \ From b655f0dae2cc2406bec0b61f7b5bd2e5c990b102 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Wed, 12 Mar 2025 09:38:42 -0700 Subject: [PATCH 6/9] Syntax fixes to pass pre-commit check --- build.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 6691d543dd..b59eb1ac25 100755 --- a/build.py +++ b/build.py @@ -1220,10 +1220,17 @@ def create_dockerfile_cibase(ddir, dockerfile_name, argmap): def create_dockerfile_linux( - ddir, dockerfile_name, argmap, backends, repoagents, caches, endpoints, rt_base_image=None + ddir, + dockerfile_name, + argmap, + backends, + repoagents, + caches, + endpoints, + rt_base_image=None ): base_image = argmap["BASE_IMAGE"] - #If runtime base image is provided, use it as the base image + # If runtime base image is provided, use it as the base image if rt_base_image: base_image = rt_base_image @@ -1647,13 +1654,18 @@ def change_default_python_version_rhel(version): def create_dockerfile_windows( - ddir, dockerfile_name, argmap, backends, repoagents, caches, rt_base_image=None + ddir, + dockerfile_name, + argmap, + backends, + repoagents, + caches, + rt_base_image=None ): base_image = argmap["BASE_IMAGE"] - #If runtime base image is provided, use it as the base image + # If runtime base image is provided, use it as the base image if rt_base_image: base_image = rt_base_image - df = """ ARG TRITON_VERSION={} ARG TRITON_CONTAINER_VERSION={} @@ -1754,8 +1766,6 @@ def create_build_dockerfiles( FLAGS.build_dir, "Dockerfile.buildbase", dockerfileargmap ) - - if target_platform() == "windows": create_dockerfile_windows( FLAGS.build_dir, @@ -1764,7 +1774,7 @@ def create_build_dockerfiles( backends, repoagents, caches, - images.get("rt_base"), + images.get("rt_base") ) else: create_dockerfile_linux( @@ -2954,7 +2964,14 @@ def enable_all(): ) fail_if( parts[0] - not in ["base", "gpu-base", "pytorch", "tensorflow", "tensorflow2","rt_base"], + not in [ + "base", + "gpu-base", + "pytorch", + "tensorflow", + "tensorflow2", + "rt_base" + ], "unsupported value for --image", ) log('image "{}": "{}"'.format(parts[0], parts[1])) From f2b260ec91c58400f75d24b28a84f59f679bd2a9 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Wed, 12 Mar 2025 09:44:22 -0700 Subject: [PATCH 7/9] Fix minor formatting issues --- build.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/build.py b/build.py index b59eb1ac25..99cabd53a3 100755 --- a/build.py +++ b/build.py @@ -1654,13 +1654,7 @@ def change_default_python_version_rhel(version): def create_dockerfile_windows( - ddir, - dockerfile_name, - argmap, - backends, - repoagents, - caches, - rt_base_image=None + ddir, dockerfile_name, argmap, backends, repoagents, caches, rt_base_image=None ): base_image = argmap["BASE_IMAGE"] # If runtime base image is provided, use it as the base image @@ -1774,7 +1768,7 @@ def create_build_dockerfiles( backends, repoagents, caches, - images.get("rt_base") + images.get("rt_base"), ) else: create_dockerfile_linux( @@ -1785,7 +1779,7 @@ def create_build_dockerfiles( repoagents, caches, endpoints, - images.get("rt_base") + images.get("rt_base"), ) # Dockerfile used for the creating the CI base image. @@ -2970,7 +2964,7 @@ def enable_all(): "pytorch", "tensorflow", "tensorflow2", - "rt_base" + "rt_base", ], "unsupported value for --image", ) From 87901c7fb3a2337ff8289caf215e995a1a430a37 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Wed, 12 Mar 2025 09:47:29 -0700 Subject: [PATCH 8/9] Minor syntax fix to pass pre-commit check --- build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.py b/build.py index 99cabd53a3..28daff7124 100755 --- a/build.py +++ b/build.py @@ -1227,7 +1227,7 @@ def create_dockerfile_linux( repoagents, caches, endpoints, - rt_base_image=None + rt_base_image=None, ): base_image = argmap["BASE_IMAGE"] # If runtime base image is provided, use it as the base image From 741135a54c50e2721270f4a532ccd5e8bd22a091 Mon Sep 17 00:00:00 2001 From: Tushar Sharma Date: Tue, 25 Mar 2025 19:05:33 -0700 Subject: [PATCH 9/9] Rename rt_base to runtime var --- build.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 28daff7124..052f77aed9 100755 --- a/build.py +++ b/build.py @@ -1227,12 +1227,12 @@ def create_dockerfile_linux( repoagents, caches, endpoints, - rt_base_image=None, + runtime_image=None, ): base_image = argmap["BASE_IMAGE"] # If runtime base image is provided, use it as the base image - if rt_base_image: - base_image = rt_base_image + if runtime_image: + base_image = runtime_image df = """ ARG TRITON_VERSION={} @@ -1654,12 +1654,12 @@ def change_default_python_version_rhel(version): def create_dockerfile_windows( - ddir, dockerfile_name, argmap, backends, repoagents, caches, rt_base_image=None + ddir, dockerfile_name, argmap, backends, repoagents, caches, runtime_image=None ): base_image = argmap["BASE_IMAGE"] # If runtime base image is provided, use it as the base image - if rt_base_image: - base_image = rt_base_image + if runtime_image: + base_image = runtime_image df = """ ARG TRITON_VERSION={} ARG TRITON_CONTAINER_VERSION={} @@ -1768,7 +1768,7 @@ def create_build_dockerfiles( backends, repoagents, caches, - images.get("rt_base"), + images.get("runtime"), ) else: create_dockerfile_linux( @@ -1779,7 +1779,7 @@ def create_build_dockerfiles( repoagents, caches, endpoints, - images.get("rt_base"), + images.get("runtime"), ) # Dockerfile used for the creating the CI base image. @@ -2964,7 +2964,7 @@ def enable_all(): "pytorch", "tensorflow", "tensorflow2", - "rt_base", + "runtime", ], "unsupported value for --image", )