I decided to make a server with Express in a container and installed nodemon to watch and reload my code modifications, but, for some reason, the nodemon on container doesn't reload when I modify my code. How can I fix that?
My Dockerfile:
FROM node:14-alpine
WORKDIR /usr/app
RUN npm install -g nodemon
COPY . .
EXPOSE 3000
CMD ["npm","start"]
My package.json:
{
"name": "prog-web-2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon app.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/willonf/prog-web-2.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/willonf/prog-web-2/issues"
},
"homepage": "https://github.com/willonf/prog-web-2#readme",
"dependencies": {
"express": "^4.17.1"
}
}
My app.js:
const express = require("express")
const app = express()
app.get("/", (req, res) => {
res.end("Hello, World!")
});
app.listen(3000);