From 15c254722862df4089ff8210d5f41d7874ec6c7a Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Mon, 24 Mar 2025 15:23:55 -0700 Subject: [PATCH 1/3] feat: add `--force-rm` flag to configure removing intermediate docker layers This commit makes it possible to turn off the removal of intermediate docker layers when building the tfb containers by adding a `--force-rm` flag to the tfb script. This is useful in situations where you want to inspect the intermediate layers for debugging purposes, or for caching builds of dependencies as a docker layer to speed up the build process. Note that the default behavior is to remove the intermediate layers to avoid filling up the disk with unused layers on the citrine server. Fixes: https://github.com/TechEmpower/FrameworkBenchmarks/issues/9718 --- toolset/run-tests.py | 4 ++++ toolset/utils/benchmark_config.py | 1 + toolset/utils/docker_helper.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/toolset/run-tests.py b/toolset/run-tests.py index a70fff3a490..a5716913cab 100644 --- a/toolset/run-tests.py +++ b/toolset/run-tests.py @@ -208,6 +208,10 @@ def main(argv=None): nargs='*', default=None, help='Extra docker arguments to be passed to the test container') + parser.add_argument( + '--force-rm', + default=True, + help='Remove intermediate docker containers after running.') # Network options parser.add_argument( diff --git a/toolset/utils/benchmark_config.py b/toolset/utils/benchmark_config.py index 48755e9f460..1a5dc339b0f 100755 --- a/toolset/utils/benchmark_config.py +++ b/toolset/utils/benchmark_config.py @@ -55,6 +55,7 @@ def __init__(self, args): self.cpuset_cpus = args.cpuset_cpus self.test_container_memory = args.test_container_memory self.extra_docker_runtime_args = args.extra_docker_runtime_args + self.force_rm_intermediate_docker_layers = args.force_rm if self.network_mode is None: self.network = 'tfb' diff --git a/toolset/utils/docker_helper.py b/toolset/utils/docker_helper.py index e48a910e99d..f25a9d133a0 100644 --- a/toolset/utils/docker_helper.py +++ b/toolset/utils/docker_helper.py @@ -39,7 +39,7 @@ def __build(self, base_url, path, build_log_file, log_prefix, dockerfile, path=path, dockerfile=dockerfile, tag=tag, - forcerm=True, + forcerm=self.benchmarker.config.force_rm_intermediate_docker_layers, timeout=3600, pull=True, buildargs=buildargs, From e8711902ccbbe05032e3e76902672f735d70a20f Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Mon, 24 Mar 2025 15:29:45 -0700 Subject: [PATCH 2/3] hyper: cache dependencies to reduce build time This change reduces the time it takes to build the hyper Docker image by caching the dependency builds. This is done by building a dummy binary before copying the source code into the image. --- frameworks/Rust/hyper/hyper.dockerfile | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/frameworks/Rust/hyper/hyper.dockerfile b/frameworks/Rust/hyper/hyper.dockerfile index b2f6b8cb6b3..4816011104f 100644 --- a/frameworks/Rust/hyper/hyper.dockerfile +++ b/frameworks/Rust/hyper/hyper.dockerfile @@ -1,8 +1,17 @@ FROM rust:1.85 AS hyper WORKDIR /src -COPY . . -RUN RUSTFLAGS="-C target-cpu=native" cargo install --path . --locked +ENV RUSTFLAGS="-C target-cpu=native" + +# Cache dependency builds (requires passing --force-rm False to tfb command) +COPY Cargo.toml Cargo.lock /src/ +RUN mkdir src \ + && echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs \ + && cargo build --release \ + && rm -rfv src/ target/release/hyper-techempower* target/release/deps/hyper_techempower* + +COPY . /src/ +RUN cargo install --path . --locked EXPOSE 8080 CMD ["hyper-techempower"] HEALTHCHECK CMD curl --fail http://localhost:8080/ping || exit 1 \ No newline at end of file From cd7cfc7a32f04ee29817b5f27b0d4416f427f58b Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Tue, 11 Nov 2025 09:01:51 -0800 Subject: [PATCH 3/3] Change default for --force-rm to False --- toolset/run-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolset/run-tests.py b/toolset/run-tests.py index a5716913cab..ac24969c4e4 100644 --- a/toolset/run-tests.py +++ b/toolset/run-tests.py @@ -210,7 +210,7 @@ def main(argv=None): help='Extra docker arguments to be passed to the test container') parser.add_argument( '--force-rm', - default=True, + default=False, help='Remove intermediate docker containers after running.') # Network options