I am facing an issue with npm test
not live reloading when running docker-compose up --build
.
My current setup is Window 10 Home, running docker toolbox. With CHOKIDAR_USEPOLLING=true
added to the .env
file in my project root. Volumes were also mounted according.
I have two services web
and tests
, running npm start
and npm test
respectively. The web
service live reload upon changes but not the tests
service, when adding new test cases.
Testing npm test
locally, it live reloads just fine upon adding new test cases.
docker-compose.yml:
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- /app/node_modules
- .:/app
tests:
build:
context: .
dockerfile: Dockerfile.dev
volumes:
- /app/node_modules
- .:/app
command: ["npm", "test"]
Dockerfile.dev:
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
CMD ["npm", "start"]