Skip to content

Trim Docker context and reuse npm downloads - #11

Merged
mvallebr merged 1 commit into
mainfrom
codex/build-cache-efficiency
Sep 19, 2026
Merged

mvallebr merged 1 commit into
mainfrom
codex/build-cache-efficiency

Conversation

@mvallebr

@mvallebr mvallebr commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The image build context includes files that are never copied into the runtime image, and npm dependency downloads are not backed by a BuildKit cache mount.

Changes

  • Add .dockerignore entries for Git metadata, dependencies, generated Next.js output, environment files, logs, deployment files, and other build-irrelevant artifacts.
  • Add an npm cache mount to npm ci in the builder stage.

Why

The smaller context reduces runner-to-BuildKit transfer and filesystem I/O. The npm cache mount speeds repeated builds on the same BuildKit worker.

The workflow already uses the minimal Harbor registry cache mode.

Trade-offs

A fresh BuildKit worker still downloads dependencies once. No runtime image contents or application behavior changes.

Validation

  • git diff --check
  • Dockerfile and workflow reviewed

@mvallebr
mvallebr merged commit a00fba7 into main Sep 19, 2026
2 checks passed
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.

1 participant