From 898d98fdb3a0ffa3d370ea38c5e2461330093966 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 26 Jun 2023 20:41:38 -0700 Subject: [PATCH] aider: Added a `build_docker()` function that builds a docker image called `benchmark` from the benchmark/Dockerfile with no other fs context. # Context: USER: add a build_docker() func that builds a docker image called `benchmark` from the benchmark/Dockerfile with no other fs context --- benchmark/benchmark.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index aa9ed8f75..21c3f6ea3 100755 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -393,5 +393,31 @@ def run_unit_tests(testdir, history_fname): return res +def build_docker(): + command = [ + "docker", + "build", + "-t", + "benchmark", + "benchmark/", + ] + print(" ".join(command)) + + try: + result = subprocess.run( + command, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + ) + res = result.stdout + print(res) + + except subprocess.CalledProcessError as e: + res = f"Failed to build Docker image: {e.output}" + + return res + + if __name__ == "__main__": app()