Skip to content

fix(docker): copy the build context files as late as possible - #464

Open
lyrixx wants to merge 1 commit into
mainfrom
copy-context-late
Open

lyrixx wants to merge 1 commit into
mainfrom
copy-context-late

Conversation

@lyrixx

@lyrixx lyrixx commented Oct 28, 2026

Copy link
Copy Markdown
Member

Refs #430, alternative to #449 and #463.

The build cache depends on the permissions of the build context files. A checkout made with a 002 umask gets 664 files instead of the 644 ones of the CI: its first cache miss was the COPY php/mods-available/ of php-base, so the PHP, nginx and Node packages were reinstalled.

The build context files are now copied as late as possible, so a miss only rebuilds cheap steps (COPY, phpenmod...). The worker stage no longer gets mods-available/, it enabled none of them.

#463 avoids every miss with a stage normalizing the permissions, but when frontend and builder are built in parallel, like castor docker:build does, builder loses its cache after php-base and reinstalls Node.

Fresh builder, cache pushed from a 644 checkout, frontend and builder built in parallel and loaded, local registry, median of 3 runs:

Checkout Duration Steps rebuilt (frontend / builder)
main 644 (like the CI) 21s 0 / 0
main 664 83s 12 / 11
#463 664 94s 1 / 9
this PR 664 30s 9 / 3

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