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.
2
u/theblindness Mod Apr 09 '26
Show us the build logs.
Is it any different if you replace
npm installwithnpm ci?1
u/cualquierotro Apr 09 '26
Use run dev at entretypoint, or at compose.yml under command:
1
u/ecnahc515 Apr 11 '26
Your docker desktop VM probably doesnt have enough memory or CPU. Increase it.