Building an image on docker with Nextjs error
Unanswered
HOTCONQUEROR posted this in #help-forum
I am facing an error when tryin to build a docker image with next.js, here is my docker image:
i get error in the
I have no idea where
How do i fix the issue?
Also, if i want to build an image in production, do i just replace the cmd commands to
#Installing and Prep Stage
FROM node:22 AS prep
WORKDIR /
# set the working directory in the container
COPY package*.json ./
# copy package.json from host machine to image current directory
RUN npm ci
# Build Stage
FROM node:22 AS build
WORKDIR /
COPY --from=prep ./node_modules ./node_modules
COPY . .
RUN npm run build
# Test Stage
FROM node:22 AS test
WORKDIR /app
COPY --from=build /.next /.next
COPY --from=build /.next ./.next
COPY --from=build /public ./public
COPY --from=build /package.json ./package.json
COPY --from=build /node_modules ./node_modules
COPY --from=build --chown=nextjs:nodejs /.next ./.next
COPY --from=build /node_modules ./node_modules
COPY --from=build /package.json ./package.json
COPY --from=build /public ./public
COPY . .
#copy everything from host machine to this image
RUN npm run test
# Running the app stage
FROM node:22 AS run
WORKDIR /app
COPY --from=build --chown=nextjs:nodejs /.next ./.next
COPY --from=build /node_modules ./node_modules
COPY --from=build /package.json ./package.json
COPY --from=build /public ./public
COPY . .
CMD ["npm","run","dev"]
i get error in the
build stage
: 172.3 ./lib/python3/dist-packages/mercurial/templates/static/mercurial.js
172.3 427:10 Error: 'ajaxScrollInit' is defined but never used. @typescript-eslint/no-unused-vars
172.3 506:10 Error: 'renderDiffOptsForm' is defined but never used. @typescript-eslint/no-unused-vars
I have no idea where
ajaxScrollinit
or renderDiffOptsForm
are coming from? neither the mercurial.js
file, but i assume it has to do with how docker build the image and not my project itselfHow do i fix the issue?
Also, if i want to build an image in production, do i just replace the cmd commands to
["npm","run","start"]
, how do i expose it to the actual domain in the case of production?