Hello, I’m trying to deploy a NextJS app that uses @mui, locally I’m able to build is without problem but when I try to deploy the app I get this error:
[Error: EMFILE: too many open files, open '/app/node_modules/@mui/icons-material/ViewInArTwoTone.js'] {
errno: -24,
code: 'EMFILE',
syscall: 'open',
path: '/app/node_modules/@mui/icons-material/ViewInArTwoTone.js'
}
this is my Dockerfile (...
are just args):
FROM node:18-alpine AS base
FROM base AS deps
RUN apk add --no-cache --virtual libc6-compat
WORKDIR /app
...
RUN echo registry=https://registry.npmjs.org/ >> .npmrc
RUN echo //npm.pkg.github.com/:_authToken=$PKG_NPM_TOKEN >> .npmrc
COPY package.json package-lock.json ./
RUN npm ci
# Rebuild the source code only when needed
FROM node:18-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
...
RUN npm run build
RUN rm -rf .npmrc
FROM node:18-alpine AS runner
WORKDIR /app
....
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"
CMD ["node", "server.js"]
am I doing something wrong? I’ve tried to search in the community but I didn’t find anything useful…