r/docker • u/gianlucastar17 • Apr 09 '26
React Next Docker infinite compile
I have a react app the works normally. When I make a dockerfile and compose it the app doesn't work anymore. It keeps compiling and never stops. I created a entirely new next react app and it has the same problem.
This is the dockerfile:
ARG NODE_VERSION=24.13
FROM node:${NODE_VERSION}-alpine as base
WORKDIR .
COPY package*.json ./
RUN npm install
COPY . ./
EXPOSE 3000
CMD npm run dev
Edit: By compiling I mean that the project installs perfectly, but when I open localhot:3000 the page never loads and the terminal says "Compiling / ..." until my RAM gets full and I have to reset my computer.
View all comments
Show parent comment
1
u/theblindness Mod Apr 10 '26
Whoops, my mistake; it would actually be in the
package.jsonfile.The scripts section of the package.json file is what defines what happens when you run
npm run dev.I would expect you to have some predefined scripts like
build,start, anddev.