Fix the prerender cache update error with the example Dockerfile (#54870)
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: https://github.com/vercel/next.js/discussions/51164
This commit is contained in:
parent
46d3a7c104
commit
49a891deb5
1 changed files with 4 additions and 0 deletions
|
@ -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 ./
|
||||
|
|
Loading…
Reference in a new issue