I've NX monorepo with a NextJS web-app. It's s very simple, just one page with "hello world", with no assets and images.
I've made a Dockerfile for my webapp, below is my Dockerfile, and here are my 3 questions:
it's dramatically slow on build, it takes more than 15 min to build image, also the image is more than 1.5Gb.
on the NX website I found an example how to configure Nx+NextJS+vercel but didn't found example of clean Dockerfile without tying to any hosting provider, so maybe somebody could advice what's wrong with my Dockerfile
not sure re last instruction: is it correct to run nextjs app with just "npm start" for production
FROM node:16-alpine AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY . .
RUN yarn install --frozen-lockfile
FROM node:16-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npx nx build webappName --prod
FROM node:16-alpine AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=deps /app/node_modules ./node_modules
RUN addgroup --system --gid 1001 nextgroup
RUN adduser --system --uid 1001 nextuser
COPY --from=builder /app/dist/apps/webappName ./
USER nextuser
EXPOSE 3000
ENV PORT 3000
CMD ["npm", "start"]