From 09d73de7f5e0954cae1e17e478540c2a7e4f711f Mon Sep 17 00:00:00 2001 From: Timothy Utsab Date: Sun, 22 Nov 2026 10:06:12 +0000 Subject: [PATCH] selfhost: own .next by node so runtime caches are writable The runtime stage copied /app/.next as root, but the container runs as node. Next writes .next/server/route-cache and the image caches under .next/cache at request time, so every prerender-cache update failed with EACCES and the cache was never written. Use COPY --chown=node:node rather than a recursive chown, which would rewrite the whole tree into another layer. --- deploy/selfhost/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/selfhost/Dockerfile b/deploy/selfhost/Dockerfile index 1cde24c..5271909 100644 --- a/deploy/selfhost/Dockerfile +++ b/deploy/selfhost/Dockerfile @@ -31,7 +31,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certifi && dpkg -i /tmp/gh.deb && rm /tmp/gh.deb \ && apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* COPY --from=build /runtime/node_modules ./node_modules -COPY --from=build /app/.next ./.next +# The runtime writes .next/server/route-cache (and image-optimizer caches under +# .next/cache) as node, so the copied tree must be node-owned. Root-owned, the server +# logs EACCES on every prerender-cache update and never writes the cache. +COPY --chown=node:node --from=build /app/.next ./.next COPY package.json pnpm-lock.yaml next.config.ts tsconfig.json instrumentation.ts ./ COPY bin ./bin # lib/ source must ship: the stream proxy dynamically imports ./phone-control.ts outside