Skip to content

Commit

Permalink
Fix the prerender cache update error with the example Dockerfile (#54870
Browse files Browse the repository at this point in the history
)

It seems the app router attempts to write its cache to both `.next/cache` and `.next/server` in docker.

This fix should fix standalone output server's error `Failed to update prerender cache... [Error: EACCES: permission denied...` when deployed in a docker container with the example Dockerfile.

Related discussion: #51164
  • Loading branch information
robertying authored Sep 1, 2023
1 parent 46d3a7c commit 49a891d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/with-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ 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

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
Expand Down

0 comments on commit 49a891d

Please sign in to comment.