Three repositories have no .dockerignore, so a local docker build fails #75
Labels
No labels
priority/P0
priority/P1
priority/P2
priority/P3
size/L
size/M
size/S
size/XL
size/XS
state/blocked
state/done
state/in-progress
state/in-review
state/needs-refinement
state/ready
type/bug
type/chore
type/feature
type/refactor
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
amtronics/platform-actions#75
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
docker buildfails inahmad/expirofrom any working copy that has runpnpm install, because the repository has no.dockerignoreand thehost's
node_modulesreaches the build context:pnpm finds a modules directory it did not create, wants to purge it, and
will not do so without a TTY. The build then fails at
RUN pnpm --filter @expiro/web build.CI is unaffected, which is exactly why nobody has hit this. A pipeline
checks out a fresh clone with no
node_modules, so the context is cleanand the build succeeds. The failure only reaches whoever tries to build or
run the image locally — reproducing a production problem, testing a
Dockerfile change, or checking what nginx actually serves, which is how it
was found (
ahmad/expiro#85).The second cost is size. Without an ignore file the whole
node_modulestree is uploaded to the daemon on every build.
ahmad/larda#63measuredthe same context at 170.82 MB against 8.91 kB once ignored.
Surveyed 2026-09-09 through the contents API. Three repositories build
from a root
Dockerfileand have no.dockerignore:.dockerignoreahmad/expiroBayan/stemahmad/launchpadahmad/larda#71)suhba/khittasuhba/suhba-docsahmad/larda#71is the worked example, and its lesson should travel withthe file rather than be rediscovered: every pattern must be prefixed
**/. A barenode_modulesmatches only at the context root, so in aworkspace it misses
apps/*/node_modules— which is the case thatmatters, and the one that looks fixed until someone checks the image.
Scope
.dockerignorein each of the three repositories, patterns**/-prefixed, covering at leastnode_modules, build output, localenv files and VCS metadata, with
!**/.env.exampleafter**/.env.*.**/-prefixed while there, but only report it, do not widen this issue.Acceptance criteria
pnpm install, whendocker buildruns from the repository root, then it completes.
then the reduction is recorded on the pull request.
node_modulesare inspected, thenthey are the ones the build installed and not the host's.
.dockerignore, when its patterns are read, then every onethat can nest is
**/-prefixed.Correcting this issue's central claim before it misleads anyone: only
one of the three actually fails.
The body says
docker buildfails from a working copy that has run aninstall, and generalises that to all three repositories. I wrote that
from one observation on
ahmad/expiroand a survey of which repositorieslack the file — not from building the other two. Built now, with an
install already run in each:
docker buildahmad/expiroCOPY . .ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTYBayan/stemCOPY . .afternpm ciahmad/launchpadCOPY . .Why they differ, since it is the useful part:
ahmad/launchpadcopiespackage.json, the lockfiles, the configs andthen
public,scripts,srcby name. The host'snode_modulescannot reach an image layer, so nothing can break. It still uploads the
whole context, because docker sends the context to the daemon
regardless of which paths the Dockerfile later copies — which is the
only cost there, and it is 171.7 MB of it.
Bayan/stemdoes end withCOPY . ., but afternpm ci, and npmhas no equivalent of pnpm's abort. So the host's modules quietly
overwrite the installed ones and the build carries on. I looked for the
consequence — platform-specific
@esbuild/*or@rollup/rollup-*packages differing between host and image — and found neither present
in this dependency tree, so there is nothing to demonstrate. The
overwrite is real; its effect here is latent.
ahmad/expirocombinesCOPY . .with pnpm, which refuses toproceed against a modules directory it did not create. That is the
failure, and it is one repository, not three.
The acceptance criteria were written for the wrong premise, so they
are answered as follows rather than ticked uniformly:
docker buildruns, then it completes" — now true everywhere;it was already true in two of the three.
above, each measured on its own repository.
node_modulesare the ones the build installed" — provenfor
expiroby pnpm completing at all, and for the other two by aCOPY . /ctxprobe image showing nonode_modulesreaches the context.**/-prefixed" — yes in all three, andthe
expiroprobe confirms it catchesapps/api/node_modulesandapps/web/node_modules, which a bare pattern would not.What I should have done when filing this: built the two repositories
I had not built, instead of generalising one failure across a survey that
only established which repositories lacked the file. The survey was
sound; the diagnosis attached to it was not.
Pull requests: ahmad/expiro#87, Bayan/stem#16, ahmad/launchpad#88.