From 16eed14501dc7b4c26c12fb9dc6c96483cd84841 Mon Sep 17 00:00:00 2001 From: Matthew Meszaros Date: Thu, 3 Sep 2026 01:04:27 -0700 Subject: [PATCH] feat: keep every frontend node_modules and build output out of the root Docker build context so a host forms/node_modules from a native make forms or make dev no longer overwrites the forms image's own pnpm install and aborts the build with ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY, set CI=true in the forms, web and admin app build stages so pnpm reinstalls instead of prompting in a build with no TTY, and document the symptom on the troubleshooting page (#292) --- .dockerignore | 13 ++++++++----- admin/Dockerfile | 2 ++ deploy/docker/forms.Dockerfile | 2 ++ docs/content/docs/development/troubleshooting.mdx | 1 + web/Dockerfile | 2 ++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2989c715..9d14a99d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,14 +11,17 @@ .vscode .agentd -# Frontend bits — the web service bind-mounts ./web directly, so we -# never want the heavyweight frontend tree to land in the Go build -# context. -web/node_modules -web/.vite +# Frontend trees: the Go images never need them, and a host node_modules +# copied over the forms image's own install makes pnpm abort the build (#292). +**/node_modules +**/.vite web/dist web/build web/coverage +forms/dist +admin/dist +site/dist +site/.astro # Compiled host binaries that would shadow / inflate the context. bin diff --git a/admin/Dockerfile b/admin/Dockerfile index 7a3f3642..318d61ea 100644 --- a/admin/Dockerfile +++ b/admin/Dockerfile @@ -5,6 +5,8 @@ # the heavy pnpm build runs only once. FROM --platform=$BUILDPLATFORM node:22-alpine AS build WORKDIR /app +# No TTY in a build: CI=true makes pnpm reinstall instead of prompting. +ENV CI=true RUN corepack enable && corepack prepare pnpm@11.9.0 --activate COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN pnpm install --frozen-lockfile diff --git a/deploy/docker/forms.Dockerfile b/deploy/docker/forms.Dockerfile index 2e8d0fc9..34c9b2aa 100644 --- a/deploy/docker/forms.Dockerfile +++ b/deploy/docker/forms.Dockerfile @@ -9,6 +9,8 @@ # $TARGETARCH (no QEMU). FROM --platform=$BUILDPLATFORM node:22-alpine AS appbuilder WORKDIR /app +# No TTY in a build: CI=true makes pnpm reinstall instead of prompting. +ENV CI=true RUN corepack enable && corepack prepare pnpm@11.9.0 --activate COPY forms/package.json forms/pnpm-lock.yaml forms/pnpm-workspace.yaml ./ RUN pnpm install --frozen-lockfile diff --git a/docs/content/docs/development/troubleshooting.mdx b/docs/content/docs/development/troubleshooting.mdx index 3e146b05..46582860 100644 --- a/docs/content/docs/development/troubleshooting.mdx +++ b/docs/content/docs/development/troubleshooting.mdx @@ -64,6 +64,7 @@ Newer builds return the invite-only refusal with its own machine code, `registra |---|---| | `no space left on device`, often from a random service mid-compile | Docker is out of disk. Free space with `docker builder prune -af` and `docker image prune -af`, check the host has about 10 GB free, then re-run `make up` | | `failed to authorize: ... EOF` while pulling a base image | A transient registry blip. Re-run `make up`; completed layers are cached | +| `ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY` while building the `forms` image | A `forms/node_modules` from a native `make forms` or `make dev` was shipped into the Docker build context and overwrote the image's own install, and pnpm will not recreate it without a terminal. Current checkouts keep every `node_modules` out of the context and run pnpm in CI mode; on an older checkout, `rm -rf forms/node_modules` and re-run `make up` | | `failed to xattr /path/._something: operation not permitted` on macOS | The checkout is on a filesystem without native extended attributes (exFAT, NTFS or a network share), so macOS writes `._*` sidecar files that BuildKit cannot read. Run `dot_clean -m .` then `find . -name '._*' -delete` and re-run. Cloning to an APFS volume avoids it | ## The stack is up but something is wrong diff --git a/web/Dockerfile b/web/Dockerfile index b646aadb..741632c8 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -5,6 +5,8 @@ # heavy pnpm build runs only once. FROM --platform=$BUILDPLATFORM node:22-alpine AS build WORKDIR /app +# No TTY in a build: CI=true makes pnpm reinstall instead of prompting. +ENV CI=true RUN corepack enable && corepack prepare pnpm@11.9.0 --activate COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN pnpm install --frozen-lockfile