I have a Next app inside of an nx monorepo (so far it's the only app). I'm building an image of it for development inside a container and when the app starts in the container, immediately after becoming available it has to do 2-3 fast refreshes (no manual code changes going on or anything). It only happens when running inside of a container, so not sure if it's something I have in my Dockerfile or compose?
FROM node:16 as base
FROM base as npm-install
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
RUN npm ci
FROM npm-install as dev-web
EXPOSE 4200
CMD ["npm", "run", "start"]
and the compose
version: "3.9"
services:
web-next:
build:
context: .
dockerfile: ./apps/demo-app/Dockerfile
target: dev-web
ports:
- "4200:4200"
volumes:
- .:/app
- /app/node_modules
here's the logs
web-next_1 | event - compiled client and server successfully in 196 ms (862 modules)
web-next_1 | [ ready ] on http://0.0.0.0:4200
web-next_1 | wait - compiling /_error (client and server)...
web-next_1 | event - compiled client and server successfully in 221 ms (863 modules)
web-next_1 | warn - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works
web-next_1 | wait - compiling /suite/[id] (client and server)...
web-next_1 | event - compiled client and server successfully in 3.5s (1638 modules)
web-next_1 | warn - Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/basic-features/fast-refresh#how-it-works
web-next_1 | wait - compiling /api/tables/[id]...
web-next_1 | wait - compiling /api/zones/[id]...
web-next_1 | event - compiled client and server successfully in 370 ms (1648 modules)
web-next_1 | event - compiled client and server successfully (1650 modules)