From 2a0e17e03905bfde40c9d7cfe9b772e155d066cb Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Mon, 31 Aug 2026 01:43:29 +0200 Subject: [PATCH] web: fix EACCES on fetch-cache by pre-creating .next/cache in image --- web/Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/Dockerfile b/web/Dockerfile index 6552cd1..7f5a89d 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -38,9 +38,12 @@ RUN adduser --system --uid 1001 nextjs COPY --from=builder /app/public ./public -# Set the correct permission for prerender cache -RUN mkdir .next -RUN chown nextjs:nodejs .next +# Set the correct permission for prerender cache. +# .next/cache must exist in the image already owned by nextjs: if a volume is +# mounted at .next/cache/, Docker creates the missing parent as root, +# and the runtime user then can't mkdir siblings like fetch-cache (EACCES). +RUN mkdir -p .next/cache +RUN chown -R nextjs:nodejs .next # Automatically leverage output traces to reduce image size # https://nextjs.org/docs/advanced-features/output-file-tracing