I am trying to set up a development environment on docker. I am running code that I made from this project.
I have seem several answers on stack-overflow but none of them solves my issue.
My package.json script is as below.
"ng": "ng",
"serve": "node server",
"start": "concurrently -c \"yellow.bold,green.bold\" -n \"SERVER,BUILD\" \"nodemon --legacy-watch ./server/index.js\" \"ng build --watch\"",
"build": "ng build --prod",
// more code...
My Dockerfile looks like this:
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install -g --force nodemon
RUN npm install
COPY . .
EXPOSE 4043
CMD ["npm", "start"]
My docker-compose.yml file looks as below:
services:
app:
container_name: express-ng-server
restart: always
image: express-ng-server-image
build: .
ports:
- '80:4043'
expose:
- 4043
When I do docker-compose up
nodemon does react to code changes.
When I run npm start
nodemon works as expected.
What am I doing wrong? How can I get nodemon to work in docker?
I am using the latest version of nodemon "nodemon": "^2.0.4",
nodemon
in a local-development environment, and not with Docker.docker-compose build
. But it still did not work. I guess I will follow your way of using nodemon; only in a local development environment and not with docker.