I generated a project with express-generator, and am making changes to various files - from app.js to the routes, and nothing causes nodemon to update. It's all in a docker container which is showing file changes properly (I've monitored the files in the docker shell to make sure docker is updating them, and it is).
My app.js and bin/www files are standard express-generator files.
package.json:
{
"name": "api",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"dev": "nodemon -L --watch . ./bin/www"
},
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"http-errors": "~1.6.3",
"morgan": "~1.9.1"
}
}
I've tried nodemon -L ./bin/www, without -L, specifying the full filesystem path (/src/), and a few other things and nodemon just does not monitor changes.
Dockerfile-node:
FROM node:14-alpine as base
WORKDIR /src
COPY ./API/package*.json /src/
EXPOSE 3000
FROM base as production
ENV NODE_ENV=production
RUN npm ci
COPY ./API/ /src
CMD ["npm", "run", "start"]
FROM base as dev
ENV NODE_ENV=development
RUN npm install -g nodemon && npm install
COPY ./API/ /src
CMD ["npm", "run", "dev"]
Relevant docker-compose.yml portion (Using version 3.8 of docker-compose):
api:
build:
context: ./
dockerfile: Dockerfile-node
target: dev
container_name: API
depends_on:
- db
restart: always
volumes:
- ./API:/src
#command: npm run dev
env_file: ./.env
environment:
DB_HOST: db
DB_PORT: 3306
DB_NAME: $DB_NAME
DB_USER: $DB_USER
DB_PASSWORD: $DB_PASSWORD
NODE_ENV: development
DEBUG: nodejs-docker-express:*
ports:
- "3000:3000"
stdin_open: true
tty: true
Docker output for the node container:
[nodemon] 2.0.14
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node bin/www`
What am I doing wrong?