From a1914abfada9dd4f8a06afccf64ba3ea69077b52 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Tue, 29 Sep 2026 20:57:57 +0200 Subject: [PATCH] fix: build the docker image from a remote git context #1118 --- .dockerignore | 3 ++- Dockerfile | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.dockerignore b/.dockerignore index e3ba81e97..b6764a50f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,7 +15,8 @@ TODO.md # Sibling projects / test harness - not part of the webmail image examples/ # Unit tests: `next build` type-checks every .ts file, and some tests import -# routes the Dockerfile deletes (app/api/dev-jmap) +# routes the Dockerfile deletes (app/api/dev-jmap). The Dockerfile deletes the +# tests as well, since a remote Git context skips this file. **/__tests__ **/*.test.ts **/*.test.tsx diff --git a/Dockerfile b/Dockerfile index b36abc8fd..c9efc1cfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,14 @@ ARG GIT_COMMIT=unknown ENV GIT_COMMIT=$GIT_COMMIT # The mock JMAP server (DEV_MOCK_JMAP) accepts any password and is for # `npm run dev` only; images ship without it. -RUN rm -rf "app/api/dev-jmap" && npx next build --webpack +# `next build` type-checks every .ts file, and some unit tests import the +# deleted route, so the tests go too. .dockerignore already drops them from a +# local context, but a remote Git context never applies .dockerignore (#1118). +RUN rm -rf "app/api/dev-jmap" && \ + find . -path ./node_modules -prune -o \ + \( -name __tests__ -o -name "*.test.ts" -o -name "*.test.tsx" \) \ + -prune -exec rm -rf {} \; && \ + npx next build --webpack FROM node:24-alpine AS runner