See Ash Code logo See Ash Code

A cache could save downloads and still cost too much disk

Ashlynn Antrobus
• • 3 min read

Should I cache package downloads for local tests, or build a Playwright image with the packages already installed?

Every web-E2E run through act still needed APT to download docker.io, unzip and their dependencies: fourteen packages before getting to the test. I wanted to stop paying that download cost on every push. A local package cache seemed like a small improvement; the alternative proposed in the October discussion was a derived Playwright image.

That immediately raised another question for a development machine whose disk was already shared by plenty of other work: how much would the extra image actually cost?

A dragon holding a package considers a stack of boxes and a nearly full disk.

Caching downloads and caching installation save different work

A cache of .deb files can serve repeated package downloads locally. The fresh job container still has to install those packages.

A derived image starts from the Playwright image and adds the installed prerequisites. A new container can then begin with those packages already present. That moves work from each test run into the image build.

The options I was comparing were:

ApproachRepeated downloadRepeated installationAdditional state to maintain
Install during every fresh jobYesYesExisting workflow
Reuse cached package filesAvoided on a cache hitYesPackage cache and its refresh policy
Build a derived Playwright imageAvoided while reusing the imageNo for baked-in packagesAdded layer, image build and rebuild policy

This was a design comparison. I didn’t produce a cache-hit benchmark or deploy a cache server as part of that conversation.

Two image names don’t necessarily mean two full copies

My objection was that I’d end up with two almost identical Playwright images on disk. The important correction was that a derived image can reuse the identical base layers. It doesn’t need another full copy of all the browser binaries just because it has a different name. Docker’s layer documentation explains that reuse.

There is still extra storage: the new package layer, build cache and potentially older image versions retained as the base changes. Counting image tags or adding up their displayed total sizes doesn’t tell me the unique disk cost.

That changes the question from “can I afford a second entire Playwright image?” to “what additional layers would I retain, and for how long?”

The rebuild policy belongs in the proposal

The suggested local image would need rebuilding when the Playwright base or system packages changed. Local act runs would also need to select it deliberately, while the hosted CI workflow continued using its intended image.

Those are maintenance decisions, even if the Dockerfile is short. A fast push today isn’t the whole cost if I later forget which image contains the prerequisites or keep several obsolete versions.

I still needed to compare the disk occupied by the added layers with the download and install time I’d save. I hadn’t measured either yet.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.