im trying to start my dev react app in Docker and developing it with live reload.
My Dockerfile:
FROM node:16.8.0-bullseye
WORKDIR /usr/src/app
COPY ./package.json .
RUN npm install
RUN npm install -g nodemon
COPY . .
CMD npm run start
My docker-compsoe.yml
version: '3'
services:
app:
build:
dockerfile: ./Dockerfile.dev
volumes:
- ".:/usr/src/app"
- "/usr/src/app/node_modules"
ports:
- 3000:3000
environment:
- CHOKIDAR_USEPOLLING=true
It starts server, but when I edit source code, it doesn't reload. What am I doing wrong?
Start React app in Docker and live reload on file changes
CodePudding user response:
try to use WATCHPACK_POLLING=true
instead of CHOKIDAR_USEPOLLING=true