From 38c3e3e2cbaf708a6d1fca2c4e6cb3cd66b187c9 Mon Sep 17 00:00:00 2001 From: Malin Date: Tue, 10 Mar 2026 10:03:55 +0100 Subject: [PATCH] fix: chown entire /app to nextjs before build so .next dir can be created --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee28bfa..30634d7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,8 @@ COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules # Remove yarn.lock so nothing accidentally invokes yarn RUN rm -f yarn.lock -# Ensure data dir is writable at runtime -RUN mkdir -p /app/data && chown -R nextjs:nodejs /app/data && chmod 755 /app/data +# Give nextjs user ownership of the entire workdir (WORKDIR creates it as root) +RUN chown -R nextjs:nodejs /app # Build the app at image build time (not at container start) USER nextjs