Skip to content

Add --force-rm flag #9727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add --force-rm flag #9727

wants to merge 2 commits into from

Conversation

joshka
Copy link
Contributor

@joshka joshka commented Mar 24, 2025

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: #9718

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.

joshka added 2 commits March 24, 2025 15:23
… 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: TechEmpower#9718
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.
Copy link
Contributor

The following frameworks were updated, pinging maintainers:
hyper: @polachok, @seanmonstar, @steveklabnik

Copy link
Member

@msmith-techempower msmith-techempower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also prepend [CI fw-only Rust/hyper] to the next commits?

parser.add_argument(
'--force-rm',
default=True,
help='Remove intermediate docker containers after running.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that if we're going to do this in the aim of improving ergonomics for contributors who need to quickly iterate implementations again and again and want those layers to persist between attempts, then this should be False by default, and we need to update our CI scripts to forcibly set to True (and our continuous scripts).

Copy link
Contributor

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know docker and so cannot review this PR.

@joshka
Copy link
Contributor Author

joshka commented Mar 27, 2025

I don't really know docker and so cannot review this PR.

No problem - you were auto tagged because I previously added you to the maintainers config on the hyper test, and because I included the hyper change to show how / why this makes sense as a change.


If you're interested a bit in how this works, each command run from a docker file creates a saved layer which can be used by future calls to docker to jump straight to that point rather than running that command again when building an image. Those intermediate layers take up space though, and tend to exhaust the benchmarking storage, so the benchmark turned that saving off.

It's useful to turn it on however for speeding up development activities. The trick to doing so in Rust projects is to compile an empty main.rs against all the dependencies listed in your manifest and lock file and then delete binary that you just created. This saves a docker layer that has a cache of all the compiled dependencies, which speeds up future compilation times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't remove docker layers (set forcerm = false)
3 participants