How to Setup Nextjs with Volumes

How to setup Volumes with Nextjs i have error when deploy.

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] Error: EACCES: permission denied, scandir '/app/public/images/lost+found'

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at Object.readdirSync (node:fs:1438:3)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at recursiveReadDirSync (/app/node_modules/next/dist/server/lib/recursive-readdir-sync.js:14:32)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at /app/node_modules/next/dist/server/lib/recursive-readdir-sync.js:19:13

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at Array.forEach (<anonymous>)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at recursiveReadDirSync (/app/node_modules/next/dist/server/lib/recursive-readdir-sync.js:15:12)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at /app/node_modules/next/dist/server/lib/recursive-readdir-sync.js:19:13

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at Array.forEach (<anonymous>)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at Object.recursiveReadDirSync (/app/node_modules/next/dist/server/lib/recursive-readdir-sync.js:15:12)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at NextNodeServer.generatePublicRoutes (/app/node_modules/next/dist/server/next-server.js:410:64)

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] at NextNodeServer.generateRoutes (/app/node_modules/next/dist/server/next-server.js:719:35) {

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] errno: -13,

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] syscall: 'scandir',

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] code: 'EACCES',

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] path: '/app/public/images/lost+found'

2023-04-10T19:21:02.953 app[1ee384ca] sin [info] }

2023-04-10T19:21:02.971 app[1ee384ca] sin [info] error Command failed with exit code 1.

[mounts]
  source="image_storage"
  destination="/app/public/images"

this my Dockerfile

# Install dependencies only when needed
FROM node:16-alpine AS builder
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile

ENV NEXT_TELEMETRY_DISABLED 1

# Add `ARG` instructions below if you need `NEXT_PUBLIC_` variables
# then put the value on your fly.toml
# Example:
# ARG NEXT_PUBLIC_EXAMPLE="value here"

RUN yarn build


FROM node:16-alpine AS runner
WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder --chown=nextjs:nodejs /app ./
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/public/images ./public/images

RUN chmod -R 777 /app/public/images

USER nextjs

CMD ["yarn", "start"]

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.