diff --git a/Dockerfile b/Dockerfile index b0674bf..d0e4cc7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,10 +67,6 @@ RUN adduser --system --uid 1001 nextjs # Copy the built application 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 standalone output (contains server.js and all dependencies) @@ -79,6 +75,10 @@ RUN chown nextjs:nodejs .next COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +# Create cache directories with correct permissions AFTER copying standalone +RUN mkdir -p .next/cache/fetch-cache .next/cache/images && \ + chown -R nextjs:nodejs .next/cache + # Copy Prisma files COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma